开发者

Translating javascript json parse to rails

开发者 https://www.devze.com 2023-03-29 09:12 出处:网络
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

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

精彩评论

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