Skip to content

Is the output of dump() guaranteed to be deterministic across versions? #2526

Answered by nlohmann
thufschmitt asked this question in Q&A
Discussion options

You must be logged in to vote

The output of the dump function should be stable between all versions, as long as you pass the same value of indentation.

The only way where the output may change is the representation of numbers. For instance, the JSON values

{"number":1000}
{"number":1E3}

are equivalent. However, in recent versions, the output remained stable. But we do not give guarantees on the written bytes, but only that the output remains equivalent.

I will need to add this to the documentation somewhere.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@thufschmitt
Comment options

@nlohmann
Comment options

Answer selected by thufschmitt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants