Replacing JSON when talking to Erlang

JSON is awesome, supported pretty much everywhere, easy to read without any extra tools (I’m looking at you BSON and Protocol Buffers) and way better than XML.

However, parsing JSON costs cycles and they are still verbose and larger than their BSON and Protobuf counterparts. What this means in practice, is that if we are paying for hosting, we are paying extra to encode/decode the JSONs and the extra bandwidth we are going to use.

However, we already have a nice JSON alternative in Erlang,External Term Format, the way erlang communicates between nodes and that can, obviously, be processed really fast on the erlang side. As a nice bonus, though not as small as protobuff, it’s still pretty compact (specially when compared to JSON, and god forbid, XML), so we can save some valuable bandwidth.

So, how hard would it be to communicate with Erlang in a way it can easily understand? Not at all really; the ETF is quite simple to understand, specially if we consider that we only need to support a subset of all its idioms.

Wanna know how to do it? Check the full article: http://inaka.net/blog/2016/08/17/why-json/

Posted on August 18, 2016

Tags: