ruby - How do I extract from this JSON? -
i'm trying extract data json, when type [0], returns '{' & if type ["tweets0"], nothing. missing obvious?
i'm using ruby & multijson gem, if changes anything.
{ "tweets0": [ { "content": "test1", "time": "2015/08/16 7:43 pm" } ], "tweets1": [ { "content": "test2", "time": "2015/08/16 7:44 pm" } ], "tweets2": [ { "content": "test3", "time": "2015/08/16 7:44 pm" } ], "tweets3": [ { "content": "test3", "time": "2015/08/16 7:46 pm" } ], "tweets4": [ { "content": "test", "time": "2015/08/16 7:45 pm" } ], "tweets5": [ { "content": "3", "time": "2015/08/16 7:48 pm" } ], "tweets6": [ { "content": "3", "time": "2015/08/16 7:48 pm" } ], "tweets7": [ { "content": "3213", "time": "2015/08/16 7:49 pm" } ], "tweets8": [ { "content": "3213", "time": "2015/08/16 7:49 pm" } ], "tweets9": [ { "content": "23", "time": "2015/08/16 7:50 pm" } ], "tweets10": [ { "content": "23", "time": "2015/08/16 7:49 pm" } ], "tweets11": [ { "content": "3", "time": "2015/08/16 7:53 pm" } ], "tweets12": [ { "content": "34", "time": "2015/08/16 7:53 pm" } ], "tweets13": [ { "content": "25", "time": "2015/08/16 7:53 pm" } ], "tweets14": [ { "content": "right", "time": "2015/08/16 7:52 pm" } ] }
if [0] returns '{', suggests me ruby isn't treating json json object, string.
maybe need .load()
json first?
Comments
Post a Comment