Skip to content

Advice on rendering JSON in a controller when multiple things need to be rendered #254

Answered by okuramasafumi
Sheikh-TDH asked this question in Q&A
Discussion options

You must be logged in to vote

Now I think your current solution using serializable_hash would be good enough.

it was pointed out to me that JSON to a hash and then back to json is taxing

serializable_hash just returns a Hash so there is not cost of converting objects into a JSON. You can build a Hash with multiple Hashes some of which are built by serializable_hash and then convert it to JSON only once.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@okuramasafumi
Comment options

@Sheikh-TDH
Comment options

@Sheikh-TDH
Comment options

@okuramasafumi
Comment options

Answer selected by okuramasafumi
@Sheikh-TDH
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants