On 12/8/19 7:48 AM, Peter Dimov via Boost wrote:
As I already stated in a previous message, if your reader can only read what your writer writes, your format is JSON in name only. A "real" JSON reader must be able to read not just the literal output of the writer, but a modified JSON file that is (per spec) equivalent to the original.
By that definition the XML serialization implemented in the Boost Serialization is not a "real" XML reader. So what. No serialization library can claim to be able to read arbitrary input and automatically map it so some pre-determined C++ data structure. If someone is interested in a JSON format for boost serialization, he can use the current XML setup as a model. If one feels that the current XML implementation is not a "real" parser - that's OK too. I do get a complaint from time to time that XML archive cannot be freely edited - but not by anyone who understands the inherent limitations of what a C++ serialization can do.
Which includes reordered fields, as you yourself wrote in the very previous paragraph.
Firstly, JSON Object is unordered, so any key permutation is a valid syntax. ECMA-404 is quite explicit about this.
And for those who might want a system of editable archives - there's another good model: Google protocol buffers. That might be a system where one describes a data structure in terms of some JSON primitives and the user uses a parser to pick this apart to build his C++ data structure and maintains this coupling as time goes on. This might be a viable, and/or interesting system, but it's unrelated to what Boost serialization currently is and has been for 15 years. Robert Ramey