Yelp JSON output is not converting to ruby hash?

Actually i'm pretty sure, that body is an Array at this point, since response contains four parts and not three, so the last two parts (an array) are put into the body-object.

Actually i'm pretty sure, that body is an Array at this point, since response contains four parts and not three, so the last two parts (an array) are put into the body-object. Also Array is the only core-object I know, which complains about an parameter being not an integer. If it was a string, it would try a regex/contain match.So to sum up, body is an Array with only one Value containing a String.

So to get your Hash (from JSON) you have to real_body = JSON. Parse body0. Then you should get your hash and real_body"businesses" puts your businesses (the output is rather long so I will not be posting it here).

Thanks for your suggestion but I think body is indeed an array but length of this array is 1. Puts body. Count prints 1 and class is Array.

There are only three response values. Any suggestion how can I get hold of businesses by using body"businesses" and other fields – Anshu Oct 22 at 2:32 what is the class of the object in the array? Maybe you should just try body0"businesses" – robustus Oct 22 at 12:56 puts body.

Class ===> Array puts body0"businesses" --> businesses – Anshu Oct 23 at 3:39 okay that actually makes sense, since your array only cotnains one object and this object is the string which you were searching for... see edited answer above for an idea ;) – robustus Oct 23 at 10:14 Perfect thanks! – Anshu Oct 24 at 5:16.

Body is a string at this point, not a hash. The operator is complaining because the string operator only takes an integer, so it's trying to turn your string into an integer and failing. Edit: you can test this by just printing out body.class.

Yes its an array but how do I get hold of body elements. JSON parsing is not working. I want to extract body"businesses" – Anshu Oct 22 at 2:41.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions