Skip to content

[FEATURE] Global JSONParserConfiguration support#1050

Closed
venkat-cheenu wants to merge 2 commits into
stleary:masterfrom
venkat-cheenu:feature_jsonparser_global_configuration_support
Closed

[FEATURE] Global JSONParserConfiguration support#1050
venkat-cheenu wants to merge 2 commits into
stleary:masterfrom
venkat-cheenu:feature_jsonparser_global_configuration_support

Conversation

@venkat-cheenu
Copy link
Copy Markdown

No description provided.

@stleary
Copy link
Copy Markdown
Owner

stleary commented Apr 6, 2026

The Java6 compiler error should be easy to fix, I think you just need to use this statement:

  private static final AtomicReference<JSONParserConfiguration> GLOBAL_CONFIG  = 
        new AtomicReference<JSONParserConfiguration>(null);

AtomicReference may not be a good idea. This lib is not thread-safe, per design. Adding it here may give the impression the project is moving in that direction, which it is not.

There are no unit tests for the new/changed code.

If some maps need to be parsed with keep-null, and some maps without it, how would you get that behavior?

I'm not convinced yet that this is the best approach. It may be that this problem should be fixed in user code.

@venkat-cheenu venkat-cheenu force-pushed the feature_jsonparser_global_configuration_support branch 2 times, most recently from ddc057d to 348128f Compare April 24, 2026 08:24
@venkat-cheenu
Copy link
Copy Markdown
Author

AtomicReference may not be a good idea. This lib is not thread-safe, per design. Adding it here may give the impression the project is moving in that direction, which it is not.

I have removed AtomicReference and am now directly using the class.

There are no unit tests for the new/changed code.

I have added unit tests to cover the new and modified code.

If some maps need to be parsed with keep-null, and some maps without it, how would you get that behavior?

This Global JSONParserConfiguration support enables user to have SystemWide setting for parsing Json. User can override it with new JSONParserConfiguration support when they dealing with to be parsed differently

@venkat-cheenu venkat-cheenu force-pushed the feature_jsonparser_global_configuration_support branch from 348128f to 56dda3c Compare April 24, 2026 08:33
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 24, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@stleary
Copy link
Copy Markdown
Owner

stleary commented May 13, 2026

@venkat-cheenu, Sorry for taking so long to respond, and thanks for your efforts on this PR. It is a reasonable implementation for a global config object, but I've been advised that a simpler and more targeted result can be achieved by updating JSONObject.put() to allow an optional JSONParserConfiguration param. #1049 will be kept open until a fix is ready.

@stleary stleary closed this May 13, 2026
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.

2 participants