Commit Graph

92 Commits

Author SHA1 Message Date
Éamonn McManus 16967f322e Simplify the check for object keys that are themselves objects.
For object keys, we can just skip the part of `nextValue()` that parses values
that are objects or arrays. Then the existing logic for unquoted values will
already stop at `{` or `[`, and that will produce a `Missing value` exception.
2023-09-27 12:42:04 -07:00
Éamonn McManus 661114c50d Generalize the logic to disallow nested objects and arrays as keys in objects.
Fixes #771.
2023-09-20 10:50:48 -07:00
Valentyn Kolesnikov 74cd73f97c Addressed compile warnings 2023-09-08 07:34:00 +03:00
dburbrid 3dd8f2ecd5 Correction of bug when compiling/testing on Windows: Issue537 file must be read as UTF-8 (Issue 745) 2023-08-28 19:03:40 +03:00
Valentyn Kolesnikov bae0b0dac9 Updated mockito 2023-08-28 19:01:47 +03:00
Valentyn Kolesnikov e563dbcaaa Setup java 8 as minimum version 2023-08-28 19:00:00 +03:00
Éamonn McManus b6ff0db984 Fix indentation in test. 2023-08-01 13:49:59 -07:00
Éamonn McManus c8a9e15a57 Don't skip past \0 when parsing JSON objects.
A better solution might be to use -1 instead 0 to represent EOF everywhere,
which of course means changing `char` variables to `int`. The solution here is
enough to solve the immediate problem, though.

Fixes #758.
2023-08-01 13:11:25 -07: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
Sean Leary 346fb26f2d Merge pull request #683 from spaffrath/Issue_682_JSONString_similarity
Issue 682 JSONString similarity
2022-08-26 20:57:22 -05:00
stleary 6daabb43ab update-copyright - Replace copyright and license restrictions with Public Domain 2022-08-23 20:00:25 -05:00
stleary e0534b3ec7 initial attempt to test for inconsistent map types in JSONObject 2022-08-20 16:14:34 -05:00
Scott Paffrath 89f16ad0af Issue 682 JSONString similarity 2022-08-05 11:00:33 -07:00
John J. Aylward beae279b21 Updates tests to have updated message expectations 2022-03-21 13:06:19 -04:00
John J. Aylward 7a124d857d Add test cases for invalid input 2022-01-26 12:19:53 -05:00
Liam Miller-Cushon 812955e39d Use IdentityHashSet for cycle detection
Fixes https://github.com/stleary/JSON-java/issues/650
2021-11-26 20:07:21 -05:00
Zach fca7e17b38 Added test cases for self recursion and complex but no recursion 2021-11-18 14:53:22 -06:00
Zach fb96e870a9 add test case and modified old ones 2021-11-17 20:00:12 -06:00
Zach 638273af7a long circle test 2021-11-17 19:41:00 -06:00
Zach 1ffcf3915c successful test 2021-11-17 19:35:53 -06:00
Liam Miller-Cushon 8ca8a80753 Fix some typos 2021-08-25 13:56:44 -07:00
stleary 8680b10716 merge from master to pick up #616 and add one more test 2021-07-26 18:07:38 -05:00
stleary 2559114dbb Merge branch 'master' into fix-similar-check 2021-07-26 17:53:20 -05:00
John Aylward 579784d73e correct error in converting doubles to big decimals 2021-07-22 23:46:31 -04:00
John Aylward c03054b1a6 Add test to show bug 2021-07-22 22:57:15 -04:00
stleary cfbc306673 Fixes Issue #611 JsonObject.similar() returns after number entry check 2021-07-18 10:32:49 -05:00
Niels Frederiksen f91d0c8a52 New JSONObject.optJSONObject method with defaultValue parameter 2021-06-23 15:15:00 +02:00
Stranck efad1d73a7 Added UnitTests
(I hope they works :c)
2020-12-04 04:09:19 +01:00
John J. Aylward e4b76d6588 Add test to demonstrate the issue. See #573 2020-11-19 18:18:27 -05: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
stleary c63e78bbc7 initial commit 2020-07-18 17:14:39 -05:00
John J. Aylward f9908a6adb adds comment on test case to document why it was added. 2020-06-25 11:51:46 -04:00
John J. Aylward ba6c4089ea fixes #531
Add test result to confirm that #531 is working in latest version.
2020-06-25 11:42:07 -04:00
John J. Aylward c11c006e88 fix tests to not depend on HashSet key order 2020-06-05 19:09:10 -04:00
stleary cf00d2f265 initial commit 2020-06-03 21:12:19 -05:00
John J. Aylward b6ed0d4178 fix failing test case in Java1.7 2020-06-03 19:37:08 -04:00
John J. Aylward 56d33b8061 changes number parsing to use BigDecimal as the backing type
* updated tests to support BigDecimal as the backing type for numbers
* updated some test resource handling to java7 try-with-resources format
* cleaned up some other minor compiler warnings
2020-05-26 10:10:36 -04:00
stleary 2b0a8838ef gradle support 2020-05-22 11:17:44 -05:00
Alan Wang 08719d4b3a Apply suggestions from code review
Co-Authored-By: Sean Leary <stleary@gmail.com>
2019-12-30 09:51:08 +08:00
Alanscut 16da56eb34 improve the confused assert message 2019-12-28 17:53:27 +08:00
John J. Aylward fb01575394 Test cases updates for standardized exception messages 2019-09-17 10:47:16 -04:00
stleary e4186e072a reduce number of iterations to shorten test time 2018-12-08 11:29:44 -06:00
John J. Aylward 3e6c0a51bd update expected exception text in tests to match unified number getters 2018-10-04 16:02:50 -04:00
John J. Aylward 3b8b0a681c Update test cases to verify performance change and verify opt/getBigDecimal match 2018-10-02 12:38:17 -04:00
Andrei Paikin d00501eabd add usage of isEmpty method 2018-05-25 22:47:05 +03:00
John J. Aylward 3fe4a767e6 Fixes incorrect syntax for JSONPointer in test. 2018-03-20 22:15:25 -04:00
Sean Leary 770cb9c4e5 Merge pull request #84 from johnjaylward/FixBeanKeyNameing
New test cases for Bean Name customization
2018-03-14 21:19:11 -05:00
John J. Aylward 193a3823b5 new test cases to support bean annotation 2018-03-11 16:56:07 -04:00
John J. Aylward aa5e80bc8d add test cases for null keys 2018-03-07 12:11:17 -05:00