Skip to content
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

Preserve order of keys when possible #20

Open
koterpillar opened this issue Oct 11, 2023 · 0 comments
Open

Preserve order of keys when possible #20

koterpillar opened this issue Oct 11, 2023 · 0 comments

Comments

@koterpillar
Copy link

I'm using git-json-merge to merge package.json files where dependencies are typically sorted alphabetically. It would be useful to have the merge preserve the relative order of items where possible, i.e.:

Base:

{
  "a": 1,
  "c": 3,
  "e": 5
}

Left change:

{
  "a": 1,
  "b": 2,
  "c": 3,
  "e": 5
}

Right change:

{
  "a": 1,
  "c": 3,
  "d": 4,
  "e": 5
}

Expected output:

{
  "a": 1,
  "b": 2,
  "c": 3,
  "d": 4,
  "e": 5
}

Actual output:

{
  "a": 1,
  "c": 3,
  "e": 5,
  "d": 4,
  "b": 2
}
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

No branches or pull requests

1 participant