hi, I have json string in json request. i want to update the database using that string. how can i do that? There would be a multipal object in this string. sample string is: [{"product":{"amt":300,"created_at":"2011-03-28T05:46:52Z","id":1,"prodnm":"maruti","qty":1,"rate":12,"updated_at":"2011-03-28T05:46:52Z"}},{"product":{"amt":2000,"created_at":"2011-04-18T09:02:45Z","id":2,"prodnm":"lux","qty":2,"rate":12,"updated_at":"2011-04-18T09:02:45Z"}}] Can anybody help me??? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
News Aanad wrote in post #993479:> hi, I have json string in json request. > i want to update the database using that string. > how can i do that? > There would be a multipal object in this string. > > sample string is: > >[{"product":{"amt":300,"created_at":"2011-03-28T05:46:52Z","id":1,"prodnm":"maruti","qty":1,"rate":12,"updated_at":"2011-03-28T05:46:52Z"}},{"product":{"amt":2000,"created_at":"2011-04-18T09:02:45Z","id":2,"prodnm":"lux","qty":2,"rate":12,"updated_at":"2011-04-18T09:02:45Z"}}]> > Can anybody help me???Deserialize the string into the separate product objects (JSON.parse from http://flori.github.com/json/ perhaps?), then use the normal object methods to perists the data I think. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Reasonably Related Threads
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- Re: what is the xml fomat about memory-backend-file
- mount.cifs: regular freezes with s3fs
- 4.0 stopped working after updating xubuntu 13.04