3 ms·
Ask HN: JSON-schema or protobuf?
We have been using JSON for our REST APIs and JSON-schema (json-schema.org) to define the data format. We have java and .net generators to create POJO and POCO classes from JSON-schema.
Recently, I got to know about Protocol Buffers from Google and was wondering what are the benefits of it over JSON. A simple Google search did not give any satisfactory answer. Hoping to get some insight from people who have used both, better if moved from one to another.
- PaulHoule 10y agoThe main benefit of protobufs is performance. It definitely is CPU intensive to write and consume JSON documents. From a software engineering perspective they seem pretty similar to me, particularly in that NEITHER has support for a fixed decimal format which is essential for doing money calculations and getting the right answers.
- msoad 10y agoSwagger uses json schema. If you want to get free documentation it makes sense to use json schema and quickly put together a swagger description of your api to get free docs for your api. You will also get a lot of good tooling around your api