I have a large amount of nested data formatted in JSON.
I would like to select for a single element:
{“data”: [
{“id”: “123456”,”from”: {“name”: “Jason Wade”,”id”:
“654321”},”message”:
“http://www.youtube.com/watch?v=ZfXHAqBRIEk”
…
-
How do I efficiently select for
a single element, say “message”? -
Is there a simple recommended
method for this? Say convert it to
an array, or something? - Could you point me to some reading for
parsing JSON?
Thanks!
If you are using Rails, see the question in my comment. If you are using pure Ruby, there is a gem called json. Install the gem, and use like this
JSON format and ruby data types have similarity and in your example, the result will be a hash like this