Codenoble

Creating quality websites and web applications

json

Cache Crispies - Fast, Flexible Rails Serializer

There are a lot of options for Rails serialization these days. However, depending on your needs, you may find, in the end, that your viable options are pretty slim.

You could go with the out-of-the-box standard, jbuilder. But it can be pretty slow. You could go with the popular Active Model Serializers, but it's current development status is less than ideal. Plus, it can also be slow and and don't count on caching to rescue you.

You might decide to turn to Netflix's Fast JSON API, which is not a bad idea at all. But you'll have to conform to the JSON:API specification, which might be a major breaking change for your frontend and/or your API consumers. I know the frontend teams I worked with weren't too happy about the prospect of switching to JSON:API when I floated the idea to them. And for good reason! That sort of thing can be a lot of work for relatively little benefit. And if it's a hassle for your own team members, imagine your unhappy API-consuming customers.

Read More