Skip to content

Serialize additional properties at the end of the json #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 29, 2020

Conversation

delvedor
Copy link
Member

In some cases, the order of the keys is important, it might be for readability or other reasons. With the current implementation, every additional property is added at the beginning of the json, making it very hard to guarantee the order of the keys if you don't know them in advance.
This pr fixes this and serialize additional/pattern properties at the end of a json string.

Not sure if we should consider this a breaking change, as usually people test their code with JSON.parse.

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

@delvedor delvedor requested a review from a team January 28, 2020 11:59
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I think this is a bug

@delvedor delvedor merged commit f7ea9fa into master Jan 29, 2020
@delvedor delvedor deleted the additional-properties-order branch January 29, 2020 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants