Skip to content

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
merged 15 commits into from
Jan 17, 2023

Conversation

dominiklohmann
Copy link
Member

@dominiklohmann dominiklohmann commented Jan 12, 2023

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.

@dominiklohmann dominiklohmann added the bug Incorrect behavior label Jan 12, 2023
@dominiklohmann dominiklohmann requested a review from tobim January 12, 2023 17:13
@dominiklohmann dominiklohmann force-pushed the story/sc-40341/json-writer-new-omit-options branch from a385304 to 7ebb527 Compare January 12, 2023 20:43
@dominiklohmann dominiklohmann marked this pull request as ready for review January 12, 2023 20:43
@dominiklohmann dominiklohmann added the feature New functionality label Jan 12, 2023
@dominiklohmann dominiklohmann requested a review from tobim January 13, 2023 09:26
@dominiklohmann dominiklohmann force-pushed the story/sc-40341/json-writer-new-omit-options branch from a3b592b to fdb9790 Compare January 17, 2023 09:29
@dominiklohmann dominiklohmann force-pushed the story/sc-40341/json-writer-new-omit-options branch from fdb9790 to 485d17c Compare January 17, 2023 09:31
Copy link
Member

@tobim tobim left a 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.

@dominiklohmann dominiklohmann merged commit c5217e1 into master Jan 17, 2023
@dominiklohmann dominiklohmann deleted the story/sc-40341/json-writer-new-omit-options branch January 17, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants