REST API - Modern Rails JSON Serializers - Which Ones To Use?

marynanogtieva

Maryna Nogtieva

Posted on February 28, 2021

REST API - Modern Rails JSON Serializers - Which Ones To Use?

Hello, fellow Rails developers and everyone who wants to participate in the discussion. I'm working on a small side project where I want to create a rails API.

I use the TDD approach (at least I try! 😅) and code in small iterations. Now after I created the whole model, validations and basic routes, the moment of truth has come...

I need to choose how my API will look like and what gem is the best to use for Serialization.

After googling and reading some articles, I found that there are a lot of blogs related to Fast JSON API which is now deprecated and kind of replaced by JSON:API Serializer. These gems are following JSON:API specification and force our API response to meet this specification standard.

On the other hand, we have Active Model Serializers. This gem is also deprecated but has another stable version 0.10.
I also found Blueprinter gem. I've never used it before and don't know its limitations.

I'm curious, what are the best practices in building robust REST APIs that are easy to use? Is it better to follow JSON:API specification or create something of your own?

For instance, looks like GitHub or Shopify responses don't follow JSON:API specification.

And if one chooses to create responses not following JSON:API standard, which gem would you prefer to use 🙃?

💖 💪 🙅 🚩
marynanogtieva
Maryna Nogtieva

Posted on February 28, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related