Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@effad
Copy link
Contributor

@effad effad commented Mar 19, 2025

This PR provides a new JSONParserConfiguration option to allow a Java Map.of("foo", null) to be converted into {"foo": null} instead of {}.

See also Issue #296 and PR #338, which was rejected due to API concerns. Since now we have a proper configuration object these concerns are addressed.

@stleary
Copy link
Owner

stleary commented Mar 21, 2025

What problem does this code solve?
When parsing a map, store null value as JSON null instead of omitting the key/value pair. This optional behavior is only available when parsing maps.

Does the code still compile with Java6?
Yes

Risks
Low

Changes to the API?
Adds a new JSONParserConfiguration option

Will this require a new release?
No

Should the documentation be updated?
No

Does it break the unit tests?
No. New unit tests were added

Was any code refactored in this commit?
No

Review status
APPROVED

Starting 3-day comment window.

@effad Thanks for the PR. If you get a chance to make the code updates, they will be included in this PR.
Otherwise, someone will make the changes in a subsequent commit.

@effad
Copy link
Contributor Author

effad commented Mar 21, 2025

@effad Thanks for the PR. If you get a chance to make the code updates, they will be included in this PR. Otherwise, someone will make the changes in a subsequent commit.

On it.

@stleary stleary changed the title Allow alternative handling of Java null values (fix for Issue #296) Option to store null value in JSONObject when parsing a map Mar 23, 2025
@stleary stleary merged commit d4c5136 into stleary:master Mar 23, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants