How to update data

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???

News A. 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs