Skip to content

fix nested object json parser issue.#90

Closed
cb-karthikp wants to merge 3 commits intov4from
fix/json-parser-util
Closed

fix nested object json parser issue.#90
cb-karthikp wants to merge 3 commits intov4from
fix/json-parser-util

Conversation

@cb-karthikp
Copy link
Collaborator

@cb-karthikp cb-karthikp commented Feb 23, 2026

  • Fixes JsonUtil to only extract top-level keys from JSON objects, preventing incorrect value extraction from nested objects/arrays (e.g., id, status, amount inside line_items or
    billing_address being returned instead of the root-level value)
  • Replaces per-call regex compilation with a single depth-aware character scanner (findTopLevelValueStart), improving both correctness and performance
  • Adds NumberFormatException handling in getLong, getInteger, getDouble, and getBigDecimal — these now return null instead of throwing on malformed/overflow values

@snyk-io
Copy link

snyk-io bot commented Feb 23, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cb-karthikp cb-karthikp linked an issue Feb 23, 2026 that may be closed by this pull request
@mpetrik-phrase
Copy link

I understand that unwanted recommendation is the worst one... but ... Is it worth fine-tuning a custom JSON parser? There are battle-tested solutions already (with all edge cases covered). Jackson might be too big, but what about GSON or https://github.com/bolerio/mjson?

Is the API size an issue at all? Definitely not for our case. Library reliability definitely is.

@cb-karthikp
Copy link
Collaborator Author

That's a perfectly fair point, and we appreciate the feedback. The library was intentionally designed with zero runtime dependencies to keep it lightweight and avoid potential version conflicts in consumers' projects.

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