Re:Specifying JSON
by nly on Thursday May 19, 2016 @10:41AM
(#11730565)
Devs who think JSON is wonderful to work with probably think so because they're using a dynamically typed language.
The advantage of a schema is you can validate your data and move to static typing in only a few lines of code. It's for this reason that I think the best option these days is to just use something like protobufs v3, which has a stable JSON serialization and a sensible schema specification.
But even for objecty data, rather than "documents", XML doesn't have to be clumsy. Checkout the code samples here for C++
The advantage of a schema is you can validate your data and move to static typing in only a few lines of code. It's for this reason that I think the best option these days is to just use something like protobufs v3, which has a stable JSON serialization and a sensible schema specification.
But even for objecty data, rather than "documents", XML doesn't have to be clumsy. Checkout the code samples here for C++
http://www.codesynthesis.com/products/xsd/