I was wondering given the JSON parser do not guarantee the sequence order whether there is a way to still enforce it. I know for Kafka Dataset provides a custom SeDe implementation that could build on top of the parser. There doesn’t seem to be such option for REST or JSON Data Transforms.
Does anyone have an insight of similar use cases and solutions you may have come across?
Thanks.
I think I found the answer myself.
Question: Is the order of elements in a JSON list preserved?
Answer: Yes, the order of elements in JSON arrays is preserved. From RFC 7159 -The JavaScript Object Notation (JSON) Data Interchange Format (emphasis mine):
- 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.
- An array is an ordered sequence of zero or more values.
- The terms “object” and “array” come from the conventions of JavaScript.
Some implementations do also preserve the order of JSON objects as well, but this is not guaranteed.