开发者

Translating javascript json parse to rails

I had to change an开发者_Go百科 application that was making a call clientside (JS) to get back data that comes back as JSON. I had to move the call server side, and I'm using rails to return the data.

To reference the object I need, with the object being returned called "data" I was able to call it JS like so:

data.photos[0].tags[0].mouth_left.x

I'm very new to rails, I have the call populating a variable called face_values, I think I should call to_json on it next, but how do I reference the arrays and nested objects within?

Even a point in the right direction would be great, thank you.


parsing JSON in Rails is as follows:

parsed_json = ActiveSupport::JSON.decode(your_json_string)

or check out this link

They claim they are 21.5x faster than ActiveSupport::JSON.decode

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜