0

I had to change an 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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I find the following link useful to explain the difference between the json gem and the Active Support library simonecarletti.com/blog/2010/04/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.