my app is posting a JSON object back to the server that is structured like so:
contacts:[{"id":38开发者_运维技巧,"full_name":"xxxxxxx","email":""},{"id":70,"full_name":"xxxxxxx","email":""},{"id":79,"full_name":"xxxx","email":""},{"id":22,"full_name":"xxxxxxx","email":""},{"id":48,"full_name":"xxxxxx","email":""},{"id":69,"full_name":"xxxxx","email":""}]
How in the controller, can I loop through each of the records and get the record.id, record.full_name etc.
Thanks
Your question is basically how do I serialize this JSON string into a ruby object (hash). You would call contacts=JSON.parse(json_string)
you can then call contacts[0].id
, etc...
精彩评论