Skip to content

How to prevent alphabetical sorting of data? #727

@sqwunkly

Description

@sqwunkly

Hi Niels,

Thanks a lot for writing your "JSON for Modern C++".

How do I save the JSON data to file while retaining it's original order (after opening and editing from an existing data.json file) such that the saved objects and their keys are subsequently not sorted alphabetically upon saving the data?

This is how I'd like the json data to be saved to file, as it was originally (not alphabetically sorted):-

image

​However after saving to file, the data ends up alphabetically sorted (below).

image

Is there a way to prevent the json data being alphabetically sorted?

Much thanks. Greg

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions