55 Commits

Author SHA1 Message Date
Sean Leary
1f308db7c4 restore-jsonparserconfiguration: Restore methods to be used for strict mode 2024-12-14 10:01:27 -06:00
Sean Leary
2ee5bf13f4
Merge pull request #907 from hexetia/fix-901
Fix a bug when calling JSONArray.addAll() with Collection as Object
2024-11-13 16:29:34 -06:00
Sean Leary
215ec9bb9c Revert "Merge pull request #877 from rikkarth/feat/871-strictMode"
This reverts commit d02ac0f2a35f8c8ba56230bc4b67275010d4d617, reversing
changes made to cfd47615d0b9a2392945d198d7fd820bbbc17437.
2024-11-03 09:50:08 -06:00
Sean Leary
ab1b9a3459 Revert "Merge pull request #888 from rikkarth/fix/887"
This reverts commit 14f71274f79ac50afb316845539f4195facc33ee, reversing
changes made to 054786e300d0fc38f0cf7fc0f2db4d9b39cb6443.
2024-11-03 09:49:23 -06:00
Lucas Nascimento
14e9cdc485
fix(#901): add the jsonparserConfiguration param to avoid a stackoverflow error 2024-10-05 11:43:00 -03:00
rikkarth
1ae43bdb90
fix(#887): regressions, unit tests
- JSONArray now evaluates EOF accordingly for empty Array inputs.
- JSONTokener fixed indentation
- externalized two JSONMLTest cases
2024-04-28 23:30:05 +01:00
rikkarth
1e3f37be98
feat(#877): add additional validation, test case 2024-04-27 22:37:21 +01:00
rikkarth
9216a19366
feat(#877): improved JSONArray and JSONTokener logic
JSONArray construction improved to recursive validation
JSONTokener implemented smallCharMemory and array level for improved validation
Added new test cases and minor test case adaption
2024-04-27 22:14:35 +01:00
rikkarth
0bace72ced
fix(#887): small typo 2024-04-21 22:09:05 +01:00
rikkarth
3dcd5b2fab
fix(#887): double array breaking JSONTokener.nextValue
change(#887): input validation
2024-04-21 11:03:15 +01:00
rikkarth
ce074e9f9a
fix(#887): corrected small typo 2024-04-14 23:23:06 +01:00
rikkarth
fe597d296e
fix(#887): complete strictMode for JSONArray 2024-04-14 23:11:17 +01:00
rikkarth
c0918c2428
feat(#871-strictMode): add allowSingleQuote option, add enhancements and simplification 2024-03-30 11:06:30 +00:00
rikkarth
8f66865e0a
Merge branch 'master' into feat/871-strictMode 2024-03-21 08:08:15 +00:00
Simulant87
6aed1cfeb6
fix typo 2024-03-18 23:07:22 +01:00
rikkarth
3672b5e158
chore(#871-strictMode): reverted unrelated changes 2024-03-17 15:20:38 +00:00
rikkarth
c51efe8b08
docs(#871-strictMode): JSONArray constructor JavaDoc update 2024-03-15 22:55:09 +00:00
rikkarth
e67abb3842
feat(#871-strictMode): improved validation, strict mode for quotes implementation 2024-03-15 22:28:31 +00:00
rikkarth
63e8314deb feat(#871-strictMode): strictMode JSONArray initial implementation
test(#871-strictMode): initial test implementation
2024-03-15 00:45:32 +00:00
Simulant
5974fc1a38 Merge branch 'master' into 863-improve-toString-performance-StringBuilderWriter 2024-03-10 21:10:21 +01:00
Simulant
06778bd2d9 #863 compute initial capacity for StringBuilderWriter 2024-02-24 21:21:06 +01:00
Sean Leary
771c82c4eb backing out recent changes to optLong, getLong. See #868 2024-02-24 13:07:51 -06:00
Simulant
7c7a98da71 #863 use StringBuilderWriter to toString methods
resulting in a faster toString generation.
2024-02-23 21:48:25 +01:00
Sean Leary
5ddb8c3d35 cleanup-and-merge-tests: fix warnings, set gradlew permissions, enable unchecked warnings in maven 2023-12-30 16:30:19 -06:00
sk02241994
7701f21839 Adding comments 2023-12-24 11:39:26 +05:30
sk02241994
abea194120 Adding JSONParserConfiguration for configuring the depth of nested maps 2023-12-22 15:47:55 +05:30
sk02241994
6d811607dd Resolving issue #743
- Recursive depth issue found in JSONObject
- Recursive depth issue found in JSONArray
2023-12-22 15:47:54 +05:30
rudrajyoti biswas
98b79ae7bf #813 - moved number conversion related common changes to utility static method. 2023-10-23 19:16:25 +05:30
rudrajyoti biswas
1d0775cce7 Revert changes with feature and refactor together. 2023-10-19 10:28:11 +05:30
rudrajyoti biswas
7b2677ac5a #790 - Update XML with changes for string to number conversion.
Moved the code logic to a common utility to de-duplicate.
2023-10-14 10:05:36 +05:30
Grzegorz Olędzki
61bb60e752 Removing excessive synchronization 2023-09-30 21:36:11 +02:00
Edijs
284a316838 Add optJSONArray and optJSONObject methods to JSONArray with a default value 2023-09-27 19:30:45 +03:00
dburbrid
4951ec48c8 Renamed object methods from ...Obj to ...Object.
Added object method for optDoubleObject (returns Double vice double).
Added similar methods in JSONArray.
Added test methods.
2023-06-29 09:39:34 +01:00
stleary
89f6e7f6a6 Merge branch 'master' into update-copyright 2022-08-26 20:59:00 -05:00
stleary
6daabb43ab update-copyright - Replace copyright and license restrictions with Public Domain 2022-08-23 20:00:25 -05:00
Scott Paffrath
89f16ad0af Issue 682 JSONString similarity 2022-08-05 11:00:33 -07:00
John J. Aylward
a642329314 Updates value error messages to be consistent.
Provide both the type and value that failed conversion. Tries not to
"toString" large value types like Arrays or Maps. For those types it
will just output the type and not a value.
2022-03-21 12:48:25 -04:00
Liam Miller-Cushon
8ca8a80753 Fix some typos 2021-08-25 13:56:44 -07:00
stleary
c6089e53f5 Fixes Issue #611 JsonArray.similar() returns after number entry check 2021-07-18 19:53:23 -05:00
Ian Lovejoy
75894086e5 Fixed incorrect cast getting float from array
Added test for getting float from array
2021-04-27 19:03:35 -07:00
Stranck
c7130d577a Oops 2020-12-04 01:09:18 +01:00
Stranck
d85eea53bb Update JSONArray.java 2020-12-04 01:07:29 +01:00
Stranck
57ad94ef5e Added clear() methods to JSONObject and JSONArray 2020-12-04 00:49:21 +01:00
John J. Aylward
11e6b1af7e fixes issue #573 by added specific compare of numeric types 2020-11-19 18:55:49 -05:00
John J. Aylward
f35194bc1d Updates the addAll methods to have optional wrapping.
When called from the constructor, the individual items in the
collection/array are wrapped as done originally before the `putAll`
methods were added.

However this commit changes how `putAll` works. The items are no longer
wrapped in order to keep consistency with the other `put` methods.

However this can lead to inconsistencies with expectations. For example
code like this will create a mixed JSONArray, some items wrapped, others
not:

```java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray(myArr); // these will be wrapped
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
```

For consistency, it would be recommended that the above code is changed
to look like 1 of 2 ways.

Option 1:
```Java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray();
jArr.putAll(myArr); // will not be wrapped
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
// our jArr is now consistent.
```

Option 2:
```Java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray(myArr); // these will be wrapped
// these will be wrapped
jArr.putAll(new JSONArray(new SomeBean[]{ new SomeBean(3), new
SomeBean(4) }));
// our jArr is now consistent.
```
2020-07-30 10:10:06 -04:00
John J. Aylward
5d828d2c0b update comments and increase speed of merging JSONArray objects 2020-07-30 10:10:06 -04:00
John J. Aylward
c175a9eb62 remove clone 2020-07-30 10:10:06 -04:00
John J. Aylward
3c9573cc3d update some javadoc 2020-07-30 10:10:06 -04:00
John J. Aylward
f37c2d67c5 Update for JSONArray.putAll methods
* Adds a copy constructor for JSONArray
* Updates the JSONArray.addAll(Object) method to be more lenient
* Adds support for JSONArray.putAll of generic Iterables
* Adds support for JSONArray.putAll of another JSONArray
2020-07-30 10:10:06 -04:00
Erik C. Thauvin
f1d354ce7b Increase array list capacity in addAll(collection) method to ensure it can hold additional elements. 2020-07-21 17:35:32 -07:00