Which JSONParserConfiguration to use in JSONObject/JSONArray constructors

Closed
#945 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
java

Research direction

Start with the JSONArray and JSONObject constructors that accept JSONTokener and JSONParserConfiguration, then trace how each configuration is applied to nested values. Compare the constructor behavior and update the corresponding JavaDocs so the single configuration source and expected behavior are explicit.

Written by the indexing model from the issue text.

Description

Fix in progress

From #927:

What is the purpose of JSONParserConfiguration parameter in JSONArray/JSONObject constructors? Is it not enough to use JSONTokener's JSONParserConfiguration? For example, when calling "JSONArray(JSONTokener x, JSONParserConfiguration jsonParserConfiguration)" constructor the array syntax is checked according to jsonParserConfiguration parameter, but nested objects/arrays syntax is checked according to JSONTokener's configuration. It seems a bit inconsistent.

Both the JSONArray/JSONObject instance and the JSONTokener parameter already have a JSONParserConfiguration. Only one of these should be used. I am leaning towards replacing the JSONTokener config instance with the config param. This should also be called out in the JavaDocs for the corresponding constructors.

Dominant language
Java
Stars
4.7k
Forks
2.6k
Avg merge
11d 18m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stleary/JSON-java

All issues in stleary/JSON-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.