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 8200133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:20:01+00:00 2026-06-07T06:20:01+00:00

In Rails, how do I access the individual elements of this json? I parsed

  • 0

In Rails, how do I access the individual elements of this json? I parsed it using ruby’s .to_json method.json = CSV.parse(csv).to_json.
Here’s what is returned:

[
[
    "id", 
    "subject"
], 
[
    "1", 
    "Economics"
], 
[
    "2", 
    "General Paper"
], 
[
    "3", 
    "History"
], 
[
    "4", 
    "Geography"
], 
[
    "5", 
    "Mathematics"
], 
[
    "6", 
    "Chemistry"
], 
[
    "7", 
    "Biology"
], 
[
    "8", 
    "Physics"
]

]

Trying to access json[0][1] or json[0] returns "["

I have a feeling it has to do with the square brackets but I’m sure there’s a way to access it (It looks like arrays in an array to me and that means of access should work)

  • 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-06-07T06:20:04+00:00Added an answer on June 7, 2026 at 6:20 am

    When you convert the data to JSON it becomes a JSON string. If you access it as an array you’ll just get the character item referenced.

    If you just want access to the data drop the to_json bit. The CSV parse should give you back the array of arrays and you can access it how you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I need to access this service from my rails app. I'm using soap4r
I am unable to access a database table in rails. I am using ruby
I need to implement fine-grained access control in a Ruby on Rails app. The
I'm a 80% ruby on rails developer, but still need to do some Access
I can't access rails man page. How can I fix this? Thanks nuno@Houdini:~/workspace/depot_a$ man
A Ruby on Rails app will have access to a number of images and
In my rails application i am using oauth to get access to the user's
Using Rails 2.3.14, I'm looking for way to access the owner of an ActiveRecord
I am using ActiveMerchant to give my rails app access to Paypal's Express Checkout.
Possible Duplicate: Access a view helper for a model in rails I know this

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.