DEV Community

Discussion on: Is Protobufs better than JSON?

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

Is it faster? Almost always, there's less protocol overhead, and the encoding and decoding is almost always less complex than for JSON.

The thing is though, does that actually matter? Unless you're sending pretty significant amounts of data, that efficiency difference is not likely to matter much for your use case, and JSON is generally easier to work with in most cases.

Personally, I prefer YAML over both unless efficiency really matters, because:

  • The short-form representation of YAML is marginally more efficient than JSON (it needs fewer quotation marks).
  • The long-form representation of YAML is easier for most people to read than JSON, making it a bit easier to debug.
  • YAML still supports custom data type representations like protobufs do.