Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7055571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:45:54+00:00 2026-05-28T03:45:54+00:00

Through an API I am getting the JSON response below with a listing of

  • 0

Through an API I am getting the JSON response below with a listing of servers.

Since this has nested JSON data what is the best way to create a model and store this data?

All I want to do with this data is store it(for now). Dont care if ipaddresses or lb_applications are flattened, there will never be more than 1 listed.

{"ips"=>[{"address"=>"127.9.34.6"}],
  "memory"=>8589934592,
  "id"=>"79ahvoahvo9h8apdjaidfjeijowfj",
  "storage"=>107374182400,
  "location_id"=>"hdfajhlnf4jaf23wf3f33fwoifjsijfsij",
  "hostname"=>"my.server.name.com",
  "description"=>"8 GB RAM + 100 GB Disk",
  "cpu"=>4.0,
  "status"=>"running",
  "lb_applications"=>
   [{"lb_application_name"=>"Staging",
     "lb_application_id"=>"2ohuro2lufp92epf9dpe0ijpdijfps9udhfp9"}]},
 {"ips"=>[{"address"=>"127.99.6.75"}],
  "memory"=>4294967296,
  "id"=>"ufho923ehufp9idf0i3jef0ijd32ddd2",
  "storage"=>53687091200,
  "location_id"=>"93fj8j93jf9hj39fh93h9g3hrg9",
  "hostname"=>"my.server2.name.com",
  "description"=>"",
  "cpu"=>2.0,
  "status"=>"running",
  "lb_applications"=>[]},
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:45:54+00:00Added an answer on May 28, 2026 at 3:45 am

    You could always serialize the hash, and then store any extra columns from the data that you might need to query.

    In your migration, you’ll add the field like its text.

    add_column :my_models, :my_hash, :text, :limit => 16000000 #only add the limit bit if the hash is exceptionally long
    add_column :my_models, :other_data, :string
    

    at the top of your model you should have:

    class MyModel < ActiveRecord::Base
      serialize :my_hash, Hash
    

    and then all you have to do when creating your model is this:

    hash = {:rawr => "Lion"}
    MyModel.create(:my_hash=>hash, :other_data=>hash[:rawr])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my graph Api for facebook.. I am getting this data.. from Json.. updated_time
All of the data on my application is pulled through an API via JSON.
I am getting photos from facebook through graph api with this call: https://graph.facebook.com/[AlbumID]/photos The
could someone help me on this problem, i want to access facebook API through
Some json from picasaweb: http://picasaweb.google.com/data/feed/api/user/100489095734859091829?kind=album&access=visible&alt=json-in-script&thumbsize=144c Here's the output as tidied up by jsonview -
I am trying to upload video on cdn server(hwcdn.net server) through api, but getting
Have gone through hibernate api specification on FlushMode but didn't get the exact difference.
In windows is it possible through an API to write to the middle of
I'm trying to search Netflix through their API, but without logging anyone in (because
I have an app that collects Perfmon counter values through the API exposed in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.