Add propertyOrder
option to ParseOptions
to control the order of …
#2926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…keys in the output, closes #2925
Type
Description
The
propertyOrder
option provides control over the order of object fields in the output. This feature is particularly useful when the sequence of keys is important for the consuming processes or when maintaining the input order enhances readability and usability.By default, the
propertyOrder
option is set to"none"
. This means that the internal system decides the order of keys to optimize parsing speed. The order of keys in this mode should not be considered stable, and it's recommended not to rely on key ordering as it may change in future updates without notice.Setting
propertyOrder
to"input"
ensures that the keys are ordered as they appear in the input during the decoding/encoding process.Example (Synchronous Decoding)
Example (Asynchronous Decoding)
Related
onExcessProperty: preserve
Behavior: Key Order Not Maintained #2925