@@ -195,8 +195,8 @@ public JSONObject(JSONObject jo, String ... names) {
195195 * @param x
196196 * A JSONTokener object containing the source string.
197197 * @throws JSONException
198- * If there is a syntax error in the source string or a
199- * duplicated key.
198+ * If there is a syntax error in the source string or a
199+ * duplicated key.
200200 */
201201 public JSONObject (JSONTokener x ) throws JSONException {
202202 this (x , x .getJsonParserConfiguration ());
@@ -210,12 +210,29 @@ public JSONObject(JSONTokener x) throws JSONException {
210210 * @param jsonParserConfiguration
211211 * Variable to pass parser custom configuration for json parsing.
212212 * @throws JSONException
213- * If there is a syntax error in the source string or a
214- * duplicated key.
213+ * If there is a syntax error in the source string or a
214+ * duplicated key.
215215 */
216216 public JSONObject (JSONTokener x , JSONParserConfiguration jsonParserConfiguration ) throws JSONException {
217+ this (x , jsonParserConfiguration , true );
218+ }
219+
220+ /**
221+ * Construct a JSONObject from a JSONTokener with custom json parse configurations, for internal use. <br>
222+ * Never call this instead of using withStrictMode(boolean).
223+ *
224+ * @param x
225+ * A JSONTokener object containing the source string.
226+ * @param jsonParserConfiguration
227+ * Variable to pass parser custom configuration for json parsing.
228+ * @param isInitial
229+ * A boolean that determines whether this object is the root.
230+ * @throws JSONException
231+ * If there is a syntax error in the source string or a
232+ * duplicated key.
233+ */
234+ JSONObject (JSONTokener x , JSONParserConfiguration jsonParserConfiguration , boolean isInitial ) throws JSONException {
217235 this ();
218- boolean isInitial = x .getPrevious () == 0 ;
219236
220237 if (x .nextClean () != '{' ) {
221238 throw x .syntaxError ("A JSONObject text must begin with '{'" );
0 commit comments