Skip to content

JSON handling does not yield predictable orders, generates bad diffs #3557

@djMax

Description

@djMax

Describe the bug
If the output type is JSON, the fields seem to be written in a mostly random order (it is almost certainly not random, but it's not 'as expected').

To Reproduce
1.) Create a JSON format collection with a number of simple string values.
2.) Create an entry - I did this manually, which may be the source of the issue.
3.) Edit the entry with NetlifyCMS by changing a single field
4.) See that the diff is not necessarily as simple as it could be

Expected behavior
IF the problem is just that it doesn't respect the order of the keys in the existing content, that seems not horrible. But if it's that it's always non-deterministically ordered, I would suggest that's a bug.

I know this bug report needs more context, and I will try to add that, but wanted to get it created per a Slack discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions