I have a JSON string in rails as shown below:
[{"content":"1D","createdTime":"09-06-2011 00:59"},{"content":"2D","createdtime":"09-06-2011 08:00"}]
which are the objects of a class content with attributes content and created time.
I would like to convert this JSON string to its respective JSON object array so that I can run a loop and decode the JSON to its objects in rails. How can I achieve this?
You can use the json library json
You can then do:
In response to your comment, you can do this, as long as your JSON fits your model