Reputation:
I have two JSON returns.
One I am able to parse fine
{"login"=>"foo", "id"=>bar,
with
@foobar_collect["login"]
But one I am having issues with
{"items"=>[{"user_id"=>foo, "user_type"=>"bar",
I try
@foobar_collect["items"]["user_id"]
And it gives me an error no implicit conversion of String into Integer
What am I doing wrong?
Upvotes: 0
Views: 364
Reputation: 29599
try
@foobar_collect['items'][0]['user_id']
The reason why your code doesn't work is @foobar_collect['items']
is an array.
Upvotes: 2