-
-
Notifications
You must be signed in to change notification settings - Fork 95
Add options to omit empty values when exporting as JSON #2856
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
dominiklohmann
merged 15 commits into
master
from
story/sc-40341/json-writer-new-omit-options
Jan 17, 2023
Merged
Add options to omit empty values when exporting as JSON #2856
dominiklohmann
merged 15 commits into
master
from
story/sc-40341/json-writer-new-omit-options
Jan 17, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a385304
to
7ebb527
Compare
tobim
reviewed
Jan 13, 2023
This simply omits ~everything~ nulls and empty values.
a3b592b
to
fdb9790
Compare
fdb9790
to
485d17c
Compare
tobim
approved these changes
Jan 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice usability improvement. Only a few minor comments.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds three new options to the JSON writer:
--omit-empty-{records,lists,maps}
.To avoid combinatory explosion in the JSON writer, which previously lifted runtime options into template arguments in what could only be considered a premature optimization, this generalizes the JSON writer to operate fully recursively and independent of the ostream writer, which was previously responsible for writing the outermost layer.
As usual, this includes some smaller cleanup where I've seen fit, for example in the accountant actor, where the function that converts metrics to JSON is now drastically simplified.