I’m working on generating the canonical JSON format, and I’m not sure if the attribute order should be the same as the one declared in the JSON Schemas, or if for JSON the order is not important.
I know for XML XSD order is important, and an attribute in the wrong order will return a validation error.
An object is an unordered collection of zero or more name/value
pairs, where a name is a string and a value is a string, number,
boolean, null, object, or array.
JSON parsing libraries have been observed to differ as to whether or
not they make the ordering of object members visible to calling
software. Implementations whose behavior does not depend on member
ordering will be interoperable in the sense that they will not be
affected by these differences.
Well, you are right, but this is only a consequence (or side effect) of XML Schema, not explicitly required by RM specs (as far as I know). There might be some old (legacy?) requirements on canonical form and relates back to computing hashes of archetypes.
In any case, it would be a at least a good (safer?) practice to stick to order of properties as they are defined in specs (reflected also in XSDs).
I guess in the server every format is mapped to the model, it is strange to have a format to format transformation, I would use the RM add an intermediate model for any transformation between formats. But if there such transformation, or should consider the ordering when generating an XML. I don’t see the issue. Can you expand?