Ask A Question

Notifications

You’re not receiving notifications from this thread.

rails API -> structuring JSON - best practices

inayk asked in Rails

Is there any better alternative to jbuilder?

Since fast_jsonapi is no longer maintained, what is the current 'best practice'? jb?

Reply

Hi!

Did you find a good solution for this? jbuilder is apparently quite unperformant and gems like active_model_serializer don't seem to be being maintained anymore, I assume that because there is some other way of doing it in 2024. How do people customize JSON API format nowadays?

In my case, I have a model with (simplifying) name, destination_address and destination_zip_code columns and I'd like my json to look like this: {"name":"foo","destination":{"address":"bar","zip_code":"baz"}}

Can anybody point me to the right direction?

Thank you!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.