The adage "The simplest things that could possibly work" comes to mind. For many things JSON is good enough.
Going with JSON first makes sense, if you need to create an alternate more efficient protocol in the future you'll at least have a few more data points to use when selecting something new like msgpack/protobuffers/thrift or whatever.
Content negotiation is a great way to expose multiple serialization formats. No reason it has to be just one of the well known formats. The main tricky part is equivalence of more complex structures in JSON, for example msgpack supports more than just string keys in maps.
In most systems I've deployed multi-format support it was a matter of a few extra lines of code rather than a doubling of effort. Pretty much all JSON values have obvious (aka. automatic) equivalents in other formats. JSON is truly the lowest common denominator, which is its strength.
Comments
Using something other than JSON is a great idea if you don't want anyone to ever bother using your API.
The adage "The simplest things that could possibly work" comes to mind. For many things JSON is good enough.
Going with JSON first makes sense, if you need to create an alternate more efficient protocol in the future you'll at least have a few more data points to use when selecting something new like msgpack/protobuffers/thrift or whatever.
Content negotiation is a great way to expose multiple serialization formats. No reason it has to be just one of the well known formats. The main tricky part is equivalence of more complex structures in JSON, for example msgpack supports more than just string keys in maps.
So now I get to support more than one format, with corresponding increases in complexity...
..But only the JSON format will have any users, and I still have to deal with anything I find objectionable about JSON.
In most systems I've deployed multi-format support it was a matter of a few extra lines of code rather than a doubling of effort. Pretty much all JSON values have obvious (aka. automatic) equivalents in other formats. JSON is truly the lowest common denominator, which is its strength.