Compare commits

...

655 Commits

Author SHA1 Message Date
Sean Leary
8439039da7 Update pom.xml
For the 20220924 release
2022-09-24 16:25:18 -05:00
Sean Leary
a6bdd081eb Update RELEASES.md 2022-09-24 16:13:11 -05:00
Sean Leary
a30d71fdca Update README.md 2022-09-24 16:11:12 -05:00
Sean Leary
cdd67b0aef Merge pull request #688 from stleary/update-copyright
#688 update copyright
2022-08-26 21:07:52 -05: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
Sean Leary
57f785c42e Merge pull request #687 from schw1804/patch-1
Fix typo
2022-08-23 17:13:10 -05:00
Joshua Schwartz
3eecd67a3b Fix typo 2022-08-23 15:00:01 -05:00
Sean Leary
5a587bbdfd Merge pull request #685 from stleary/map-unit-tests
JSONObject map type unit tests
2022-08-23 07:59:35 -05:00
stleary
e0534b3ec7 initial attempt to test for inconsistent map types in JSONObject 2022-08-20 16:14:34 -05:00
spaffrath
7dd9e01dae Merge branch 'stleary:master' into Issue_682_JSONString_similarity 2022-08-20 07:51:30 -07:00
Sean Leary
88ca19042b Merge pull request #684 from stleary/pipeline-fix-1
pipeline-fix-1 remove v7 build from pipeline
2022-08-20 08:33:23 -05:00
stleary
b4036e6a8e pipeline-fix-1 remove v7 build from pipeline 2022-08-13 12:50:10 -05:00
Scott Paffrath
89f16ad0af Issue 682 JSONString similarity 2022-08-05 11:00:33 -07:00
Sean Leary
6f92a3ab4e Merge pull request #675 from johnjaylward/Iss-649-better-error-message
Updates value error messages to be consistent.
2022-03-24 20:32:31 -05:00
John J. Aylward
beae279b21 Updates tests to have updated message expectations 2022-03-21 13:06:19 -04: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
Sean Leary
9abb35ad39 Update RELEASES.md 2022-03-20 09:34:12 -05:00
Sean Leary
c0a1d5f741 Update pom.xml 2022-03-20 09:28:19 -05:00
Sean Leary
04a765647e Update README.md 2022-03-20 09:27:38 -05:00
Sean Leary
4f78ec666a Update RELEASES.md 2022-03-20 09:25:53 -05:00
Sean Leary
7d6b76de37 Merge pull request #608 from artem-smotrakov/setup-codeql-scans
Include CodeQL scan in the commit checks
2022-02-06 12:19:41 -06:00
Sean Leary
5cfe216ffd Update codeql-analysis.yml
...
2022-02-04 08:08:41 -06:00
Sean Leary
c33ad9c062 Merge pull request #660 from johnjaylward/Issue654StackOverflowError
Wrap StackOverflow with JSONException to fix Issue #654
2022-01-31 08:54:53 -06:00
John J. Aylward
7a124d857d Add test cases for invalid input 2022-01-26 12:19:53 -05:00
Sean Leary
f1b0210b8a Update README.md 2021-12-05 10:36:03 -06:00
Sean Leary
8ef8e1463d Update pom.xml 2021-12-05 09:12:55 -06:00
Sean Leary
48b6aa3e4c Update RELEASES.md 2021-12-05 09:10:32 -06:00
Sean Leary
cff5cc6c74 Merge pull request #646 from Zetmas/feature/issue#595
XMLParserConfiguration support for xml to json arrays
2021-12-03 19:37:00 -06:00
Sean Leary
04e8ea84dc Merge pull request #651 from cushon/i650
Use IdentityHashSet for cycle detection
2021-12-03 19:35:26 -06: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
Sean Leary
bc623e36d6 Merge pull request #645 from Zetmas/feature/issue#632
Detect and handle circular references when parsing Java beans
2021-11-21 11:31:48 -06:00
Zach
5dd78bc0b9 Test case passed with tags with multiple entries set forceList 2021-11-19 21:22:38 -06:00
Zach
e638955034 Pass test case for empty tag with forceList 2021-11-19 21:05:05 -06:00
Zach
3f9b53fee4 longer forcelist tests 2021-11-19 20:55:10 -06:00
Zach
a0f90b776d Passed simple test 2021-11-19 20:46:15 -06:00
Zach
fafaeb7aa6 Added simple test case 2021-11-19 20:32:36 -06:00
Zach
e356739a2f Added forceList configuration to XMLParserConfiguration 2021-11-19 19:42:00 -06: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
Zach
4565bddcbb data class for recursive test 2021-11-17 17:23:40 -06:00
Zach
b5bcb68968 added set check logic 2021-11-17 16:57:41 -06:00
Zach
7823d3a4f3 locate the pace for cyclic check 2021-11-17 15:28:01 -06:00
Sean Leary
d6227c83d7 Merge pull request #640 from katldewitt/561-backslashes
Address #561: Add unit tests for multiple backslashes
2021-11-02 11:44:49 -05:00
Sean Leary
f54b5e4b0d Merge pull request #626 from loic5/patch-1
Create CODE_OF_CONDUCT.md
2021-10-29 15:49:43 -05:00
Loïc Lengrand
30b3680050 Update CODE_OF_CONDUCT.md
I replaced the email address
2021-10-29 09:38:19 +02:00
katldewitt
3ed9154f63 fix: refactor tests
context: the backslash unit tests cannot be in the complete document as uriFragmentNotationRoot() will fail due to backslash handling
2021-10-28 05:59:22 -07:00
katldewitt
669316d29e chore: write unit tests for behavior 2021-10-28 05:45:23 -07:00
katldewitt
30a70c8886 chore: initial unit tests 2021-10-24 08:41:57 -07:00
Sean Leary
93f4b34890 Merge pull request #637 from Ronqn/master
Reorganized README.md
2021-10-17 20:44:46 -05:00
Ronqn
9c87d6e214 Updated README.md 2021-10-16 16:43:10 +02:00
Ronqn
f27e5fe04d Docs folder containing the contributions files 2021-10-16 16:42:55 +02:00
Sean Leary
2528e60b09 Merge pull request #634 from JanitSri/update-README
updated the README to include commands for Unix systems
2021-10-16 09:17:45 -05:00
Sean Leary
4e601fd46e Merge pull request #631 from sreekesh93/techdebt/refactor-test
Refactor JSONPointerTest
2021-10-14 16:58:45 -05:00
Janit Sriganeshaelankovan
9f19c22b77 updated the README to include commands for Unix systems 2021-10-14 16:43:30 -04:00
sreekesh93
9000901a11 Fix test to support oreder mismatch 2021-10-11 19:55:31 +05:30
sreekesh93
f03eb56071 Fix test to support oreder mismatch 2021-10-11 19:46:27 +05:30
sreekesh93
b4bbc58644 Refactor JSONPointerTest 2021-10-11 10:42:31 +05:30
Sean Leary
cf43419015 Update pipeline.yml
replace hardcoded Ubuntu version with "Ubuntu-latest"
2021-10-09 10:14:47 -05:00
Loïc Lengrand
e896497602 Create CODE_OF_CONDUCT.md
hello i propose to create a Code of conduct :)
2021-10-08 16:35:55 +02:00
Sean Leary
d284c81e16 Update README.md 2021-10-05 21:01:55 -05:00
Sean Leary
a526b41b67 Create CONTRIBUTING.md 2021-10-05 20:56:25 -05:00
Sean Leary
9f07853f19 Merge pull request #622 from pedrombmachado/patch-1
Update README.md
2021-08-28 15:38:21 -05:00
Pedro Machado
e29c541353 Update README.md
corrected the backward slash into forwarding slash
2021-08-28 21:28:31 +01:00
Sean Leary
de5f768cff Merge pull request #621 from cushon/typos
Fix some typos
2021-08-25 20:10:30 -05:00
Liam Miller-Cushon
8ca8a80753 Fix some typos 2021-08-25 13:56:44 -07:00
Sean Leary
fb71d9d40f Merge pull request #606 from artem-smotrakov/fix-javadoc
Fix javadoc
2021-08-17 20:40:04 -05:00
Sean Leary
b80141a19c Merge pull request #607 from artem-smotrakov/add-security-policy
Added a security policy
2021-08-14 15:02:05 -05:00
Sean Leary
c0e467c848 Merge pull request #613 from stleary/fix-similar-check
Fixes Issue #611 JsonObject.similar() returns after number entry check
2021-07-26 18:12:44 -05: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
Sean Leary
bb048e3ffb Merge pull request #617 from johnjaylward/issue-616-similar-bug
Fixes #616 similar() problem comparing double vs BigDecimal
2021-07-26 17:47:03 -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
John Aylward
4e0faebe62 fix javadoc errors that prevent compilation in Eclipse 2021-07-22 22:54:46 -04:00
stleary
c6089e53f5 Fixes Issue #611 JsonArray.similar() returns after number entry check 2021-07-18 19:53:23 -05:00
stleary
cfbc306673 Fixes Issue #611 JsonObject.similar() returns after number entry check 2021-07-18 10:32:49 -05:00
Sean Leary
449ec8745e Merge pull request #610 from tilds/optJSONObject-defaultValue
New JSONObject.optJSONObject method with defaultValue parameter
2021-06-28 22:01:37 -05:00
Niels Frederiksen
f91d0c8a52 New JSONObject.optJSONObject method with defaultValue parameter 2021-06-23 15:15:00 +02:00
stleary
4571978840 Merge branch 'master' of https://github.com/stleary/JSON-java 2021-06-22 19:46:44 -05:00
stleary
76ec2fe5a2 Revert accidentally changed file 2021-06-22 19:46:33 -05:00
Sean Leary
0200c984cc Update README.md 2021-06-22 19:41:31 -05:00
stleary
8f3e5ade18 Add logo image 2021-06-22 19:34:22 -05:00
Artem Smotrakov
20b4f85efe Updated build command in the CodeQL workflow 2021-05-31 15:30:20 +02:00
Artem Smotrakov
5bc8dae5d0 Setup CodeQL scans 2021-05-31 15:24:41 +02:00
Artem Smotrakov
8fa9be742c Added a security policy 2021-05-31 15:16:27 +02:00
Artem Smotrakov
b48abe6558 Suppress java/unchecked-cast-in-equals warning for JSONObject.Null.equals() 2021-05-31 15:00:29 +02:00
Artem Smotrakov
97023e1098 Fix Javadoc formatting in JSONObject and XMLParserConfiguration 2021-05-31 14:53:59 +02:00
Sean Leary
143db39d27 Merge pull request #604 from ianlovejoy/master
Fixed incorrect cast getting float from array
2021-05-01 08:50:54 -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
Sean Leary
fa46da45f4 Merge pull request #601 from AISS-2021-L5-G02/master
Added some examples for new-comers in a Markdown file
2021-04-21 00:31:12 -05:00
TheNeoStormZ
f912e5d1c4 Merge pull request #2 from TheNeoStormZ/master
Changed JSONExamples to a Markdown file (and another place) with mino…
2021-04-02 19:31:42 +02:00
Pablo Marín Gómez
6bf3d38889 Changed JSONExamples to a Markdown file (and another place) with minor tweaks 2021-04-02 19:28:37 +02:00
TheNeoStormZ
c62df81b3e Merge pull request #1 from TheNeoStormZ/master
Added some examples for new-comers
2021-04-02 11:28:25 +02:00
Pablo Marín Gómez
e1f69ff3fe Added some examples for new-comers 2021-04-02 11:25:57 +02:00
Sean Leary
50d619698f Merge pull request #594 from anton0xf/patch-1
JSONStringer.java: fix max nesting level in javadoc
2021-03-18 19:42:49 -05:00
anton0xf
29103e3228 JSONStringer.java: fix max nesting level in javadoc 2021-03-14 22:45:38 +05:00
Sean Leary
2630676f36 Update README.md 2021-03-09 19:54:54 -06:00
Sean Leary
7299b201f4 Update pom.xml 2021-03-07 21:11:48 -06:00
Sean Leary
8cc1e9830d Update README.md 2021-03-07 21:09:01 -06:00
Sean Leary
c43e21ae73 Merge pull request #588 from fossterer/563-jsonpointer-do-not-encode-quotes
JSONPointer should not process reverse solidus or double-quote chars in tokens
2021-03-06 10:00:32 -06:00
Shashank Sabniveesu
d6ccc64c79 Closes 563: As never defined in RFC 6901 Section 3, do not handle backslashes (\) and quotes(") as anything special 2021-02-28 16:03:14 -05:00
Sean Leary
7844eb79cd Merge pull request #583 from ek08/fix
Checked the length of key for checker framework
2021-02-01 19:48:06 -06:00
Ehtesham
5b531faa49 Improved the logic for checking the length of key 2021-01-28 15:31:23 +05:30
Ehtesham
31ff8a2291 Checked the length of key for checker framework 2021-01-27 11:35:38 +05:30
Sean Leary
e33f463179 Merge pull request #581 from valfirst/patch-1
Use built-in Gradle shorthand notation for Maven Central repository
2021-01-10 18:35:31 -06:00
Valery Yatsynovich
e77a77e841 Use built-in Gradle shorthand notation for Maven Central repository 2020-12-29 14:16:46 +03:00
Sean Leary
26f48484fd Merge pull request #577 from stranck/master
Added clear() methods to JSONObject and JSONArray
2020-12-07 16:54:18 -06:00
Stranck
efad1d73a7 Added UnitTests
(I hope they works :c)
2020-12-04 04:09:19 +01: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
Sean Leary
a57eff26d5 Merge pull request #575 from johnjaylward/fix-similar-compare-numbers
Fix similar compare numbers
2020-11-22 15:23:03 -06:00
John J. Aylward
68883b9ff8 update number handling to use new helper method for consistency. 2020-11-19 19:10:08 -05: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
e4b76d6588 Add test to demonstrate the issue. See #573 2020-11-19 18:18:27 -05:00
John J. Aylward
3a8193bea4 upgrade junit version 2020-11-19 18:18:02 -05:00
Sean Leary
6bf2692a94 Update README.md 2020-11-15 16:09:50 -06:00
Sean Leary
fdde43cd3b Update README.md 2020-11-15 12:48:51 -06:00
Sean Leary
6b779f8ca7 Merge pull request #570 from stleary/update-readme
Readme - fix spelling and usage, per Grammarly
2020-10-23 23:05:38 -05:00
stleary
59b7a7adff fix spelling and usage, per Grammarly 2020-10-16 08:58:04 -05:00
Sean Leary
7abd89b4bc Merge pull request #540 from kumar529/master
Added type conversion support
2020-09-17 07:37:31 -05:00
Rahul Kumar
56d4130a86 Added shallow copy for config map 2020-09-06 11:17:10 +05:30
Rahul Kumar
ed9658d5cb Corrected Javadoc 2020-09-04 16:51:55 +05:30
Rahul Kumar
310f18fcdc Addressed comment 2020-09-03 11:17:10 +05:30
Rahul Kumar
900a8cc945 Removed changes from depricated method 2020-08-06 07:29:32 +05:30
Rahul Kumar
0a8091c954 Added documentation 2020-08-05 22:25:45 +05:30
Rahul Kumar
61c1a882d6 Added configuration support for type conversion using Map 2020-08-03 08:54:59 +05:30
Rahul Kumar
250f74ef4d Added type conversion support 2020-08-03 08:18:20 +05:30
Sean Leary
5541a6d91d Merge pull request #552 from johnjaylward/JSONArrayCopyConstructor
Updates for JSONArray.putAll methods
2020-08-01 09:19:29 -05:00
John J. Aylward
d30ecad7f8 Update README for best practices when using putAll on JSONArray 2020-07-30 10:13:01 -04: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
Sean Leary
6351fa63aa Merge pull request #549 from stleary/rewrite-readme
Update readme.md
2020-07-28 23:48:01 -05:00
Sean Leary
870fa03a19 Merge pull request #529 from ethauvin/master
Added putAll(Collection) and putAll(Array) methods.
2020-07-25 12:45:44 -05:00
Sean Leary
555f712a8c Update README.md 2020-07-25 12:41:03 -05:00
Sean Leary
db2d1714de Update README.md 2020-07-25 12:40:41 -05:00
Sean Leary
650f52501a Update README.md 2020-07-25 12:36:53 -05:00
Sean Leary
896674ae36 Update README.md 2020-07-25 12:35:58 -05:00
Sean Leary
8f0c3b0bf8 Update README.md 2020-07-25 12:35:12 -05:00
Sean Leary
0de8d0d2e0 Update README.md 2020-07-25 12:34:01 -05:00
Sean Leary
46fe58e912 Update README.md 2020-07-25 12:31:20 -05:00
Sean Leary
26cd17687f Update README.md 2020-07-25 12:31:02 -05:00
stleary
879fba3f7f rewrite - first commit 2020-07-25 12:27:20 -05:00
stleary
98cd8ef8b2 fix CI build error 2020-07-24 03:24:41 -05:00
Sean Leary
78528102d0 Merge pull request #543 from johnjaylward/RefactorXmlConfiguration
Refactor XMLConfiguration to use Builder Pattern
2020-07-24 02:49:28 -05:00
Sean Leary
0e34d8d383 Merge pull request #539 from stleary/unit-tests-1.6
Bring Junit tests to Java 1.6 compatibility
2020-07-24 02:48:38 -05:00
Sean Leary
880402120c Merge pull request #542 from johnjaylward/fixXmlHexEntityParse
Fix xml hex entity parse
2020-07-23 11:02:14 -05:00
Sean Leary
d10725dc92 Merge pull request #538 from stleary/readme-local-build
Explain local builds in the readme, fix a couple of typos
2020-07-23 11:00:25 -05:00
Erik C. Thauvin
0d13e56064 Added tests for consecutive calls to putAll. 2020-07-21 23:09:28 -07: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
Erik C. Thauvin
86e136afc9 Increase array list capacity in addAll method to ensure it can hold additional elements. 2020-07-21 17:11:24 -07:00
John J. Aylward
4f1c8b2d6f formatting 2020-07-21 11:30:35 -04:00
John J. Aylward
5a31f9ef5f Refs #541
Updates XML configuration to use a builder pattern instead of
constructors with many parameters
2020-07-21 11:08:40 -04:00
John J. Aylward
c136668f23 remove new lines from test file text blocks to prevent issues with the
parsing compare on different operating systems
2020-07-20 18:58:00 -04:00
John J. Aylward
e18f42becc fixes #537 corrects case-sensitive entity unescape 2020-07-20 18:38:35 -04:00
John J. Aylward
e0a6c2ef34 refs #537 Show error when unescaping all-caps entity directly 2020-07-20 18:36:52 -04:00
John J. Aylward
c98da43184 Refs #537 Add test cases to verify no issue 2020-07-20 18:25:51 -04:00
John J. Aylward
734f182242 Update error messages to use the built in assertEquals 2020-07-20 18:25:22 -04:00
stleary
c63e78bbc7 initial commit 2020-07-18 17:14:39 -05:00
stleary
db6ca7fbf3 even more formatting 2020-07-18 13:11:13 -05:00
stleary
9a3e7dd7c4 more formatting 2020-07-18 13:08:38 -05:00
stleary
79ff79ed70 initial commit 2020-07-18 13:05:55 -05:00
stleary
d14c7b9127 formatting 2020-07-18 13:02:51 -05:00
stleary
de4395dc5e initial commit 2020-07-18 12:59:34 -05:00
Sean Leary
6ddaa13c1e Merge pull request #532 from johnjaylward/CheckBigDecimalSupport
Verifies BigDecimal support does not have a regression
2020-06-25 17:02:18 -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
Erik C. Thauvin
aa0a5a7245 Added putAll(Collection) and putAll(Array) methods. 2020-06-16 14:55:16 -07:00
Sean Leary
9de97438ac Merge pull request #524 from viveksacademia4git/i516-JSONArray-ConstructParam-InitCapacity
Development for stleary#516 completed with rebased repository
2020-06-12 10:48:21 -05:00
Sean Leary
601114ee29 Merge pull request #527 from johnjaylward/GithubAction
Fixes for Unit tests and supports GitHub Actions
2020-06-05 18:39:48 -05:00
John J. Aylward
c11c006e88 fix tests to not depend on HashSet key order 2020-06-05 19:09:10 -04:00
John J. Aylward
96bf788515 update pipline to use matrix configuration 2020-06-05 18:55:48 -04:00
viveksacademia4git
f4261add91 Create pipeline.yml 2020-06-05 17:15:55 -04:00
Sean Leary
dced1b4a44 Merge pull request #526 from stleary/broken-unit-tests
comment out some broken unit tests
2020-06-03 21:25:50 -05:00
stleary
cf00d2f265 initial commit 2020-06-03 21:12:19 -05:00
Sean Leary
95c6373122 Merge pull request #525 from johnjaylward/unitTestFixes
Unit test fixes
2020-06-03 19:49:06 -05:00
John J. Aylward
b6ed0d4178 fix failing test case in Java1.7 2020-06-03 19:37:08 -04:00
John J. Aylward
75f656fd07 revert changes to build.gradle 2020-06-03 17:59:04 -04:00
viveksacademia4git
4b84ba2f66 Changes to make the Gradle work
- commented `java() {...}` within build.gradle
- added following files
   1. gradlew
   2. gradlew.bat (for windows)
   3. gradle/wrapper/gradle-wrapper.properties (for ./gradlew command execution)
   4. gradle/wrapper/gradle-wrapper.jar (for ./gradlew command execution)
2020-06-03 12:14:45 -04:00
vivek
d088cf014e Development for stleary#516 completed with rebased repository
- Introduced JSONObject(int) constructor.
   - int > Initial capacity of the underlying data structure

- Test for new introduced JSONArray(int) constructor.
   1. Checked with input parameter: 0
   2. Checked with input parameter: positive number
   3. Checked with positive number input parameter and compared length
   4. If input parameter is negative number JSONException is thrown:
         JSONArray initial capacity cannot be negative.
2020-06-03 11:46:48 +02:00
Sean Leary
19bb6fd606 Merge pull request #453 from johnjaylward/UseBigDecimalDefaultParse
changes number parsing to use BigDecimal as the backing type
2020-06-01 14:03:04 -05:00
Sean Leary
fee6ddb922 Merge pull request #521 from johnjaylward/CookieFlagSupport
Updates Cookie class to be more generic in attribute parsing and emit.
2020-05-29 09:59:27 -05:00
Sean Leary
5a32114792 Unified license for both src and test
All code in the project is covered by the original license
2020-05-27 08:23:09 -05: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
John J. Aylward
6029dece41 ensure key names are consistent when parsing the cookie string since
cookie-keys are not case sensitive, but json-keys are.
2020-05-26 09:11:10 -04:00
John J. Aylward
d334b58f45 Made more corrections to Cookie.ToString.
1. Made Cookie Name and Value properties case insensitive
2. Throws exception on illegal Cookie Name
3. Doesn't emit "false" flag values
4. Properly escape key-value attributes.
2020-05-26 08:55:19 -04:00
John J. Aylward
b4a75c7bf8 Updates Cookie class to be a more generic in attribute parsing and emit.
This is so the library can age better as new attributes are added to RFC
revisions.
2020-05-26 08:53:37 -04:00
Sean Leary
956bdfa5b7 Merge pull request #519 from stleary/gradle-support
Gradle support
2020-05-23 10:20:32 -05:00
stleary
8546e68e20 update readme 2020-05-22 11:44:21 -05:00
stleary
0832d1d873 gradle support 2020-05-22 11:24:20 -05:00
stleary
2b0a8838ef gradle support 2020-05-22 11:17:44 -05:00
Sean Leary
1da2b984cd Update README.md 2020-05-22 10:50:04 -05:00
Sean Leary
78901383a4 Update README.md 2020-05-22 10:41:55 -05:00
Sean Leary
3737c987a2 Merge pull request #515 from BGehrels/merge-tests-and-pom-and-code
Merge tests and pom and code
2020-05-22 10:40:48 -05:00
Sean Leary
8e5b516f2b Update README.md 2020-05-17 22:41:27 -05:00
Benjamin Gehrels
82202dbf65 Added Jar plugin version to get rid of a warning 2020-04-30 12:23:39 +02:00
Benjamin Gehrels
89d4681e41 Added information on how to release to the pom 2020-04-29 21:02:52 +02:00
Benjamin Gehrels
1265897f4e Merge remote-tracking branch 'tests/master' into upstream 2020-04-29 20:26:05 +02:00
Benjamin Gehrels
74e4932cfc Transform the repository into standard maven format and merge the pom.xml of the release repo 2020-04-29 19:24:44 +02:00
Sean Leary
f07ddd93e5 Merge pull request #96 from Alanscut/bean-test
improve the confused assert message
2019-12-30 12:31:58 -06: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
Sean Leary
6b6e8e85d8 Merge pull request #502 from Alanscut/issue-500
update JSONTokener's brief: parse simple json text
2019-12-26 20:56:51 -06:00
Alanscut
6ecbeaa0d2 update JSONTokener's brief: parse simple json text 2019-12-25 11:38:38 +08:00
Sean Leary
3ac647a16f Merge pull request #499 from Alanscut/copyright
Add copyright notice to JSONString, JSONException.
2019-12-23 08:31:01 -06:00
Alanscut
6f06801296 add copyright 2019-12-22 19:17:58 +08:00
Sean Leary
dd7056cb6d Merge pull request #495 from harkue/master
fix typo
2019-11-20 11:20:18 -06:00
harkue
e62d763294 rename hasComma as a better name "needsComma" 2019-11-13 11:46:21 +08:00
harkue
4990c3a180 fix typo 2019-11-12 16:27:24 +08:00
Sean Leary
4b49bc94ce Merge pull request #494 from spaffrath/replace_string_arrays_with_var_args
Replace JSONObject constructor string arrays with var args
2019-11-06 09:31:23 -06:00
Sean Leary
9afa90d9a9 Merge pull request #492 from ggavriilidis/ISSUE-491_clarify_intention_of_JSONArray_toList
Issue-491 - Clarify what the output of the method JSONArray toList is
2019-10-29 22:24:45 -05:00
gavriil
065f9a94bc Issue-491 - modified the comment of JSONArray toList method to clarify what the output of the method is 2019-10-29 21:35:58 +00:00
scott
223e328161 Replace JSONObject constructor string arrays with var args 2019-10-16 21:12:02 -07:00
Sean Leary
18eddf75c3 Merge pull request #95 from johnjaylward/StandardizeExceptionMessages
Test cases updates for standardized exception messages
2019-09-24 20:30:08 -05:00
Sean Leary
044b035847 Merge pull request #486 from johnjaylward/StandardizeExceptionMessages
Standardize Exception Messages
2019-09-24 20:29:17 -05:00
Sean Leary
b8fd9d0082 Merge pull request #94 from johnjaylward/FixMLInfiniteLoop
new test case for issue 484
2019-09-23 17:57:16 -05:00
Sean Leary
5b62cf13ff Merge pull request #485 from johnjaylward/FixMLInfiniteLoop
Fix for #484
2019-09-23 17:56:53 -05:00
John J. Aylward
a24db2cce2 remove unused import 2019-09-17 11:15:25 -04:00
John J. Aylward
67e59888a2 add second case for data in #484 2019-09-17 11:14:41 -04:00
John J. Aylward
e9c27ab376 standardize exception messages 2019-09-17 11:08:26 -04:00
John J. Aylward
fb01575394 Test cases updates for standardized exception messages 2019-09-17 10:47:16 -04:00
John J. Aylward
3e7a0b13d1 new test case for issue 484 2019-09-17 10:36:48 -04:00
John J. Aylward
328e7d8944 corrects EOL error when the Meta tag isn't closed properly and we reach
the end of the input.
2019-09-17 10:33:26 -04:00
Sean Leary
2a6af29235 Merge pull request #483 from viniciusls/patch-1
Update README.md to point to latest version
2019-09-07 09:01:19 -05:00
Vinícius Silva
af6d3c63bd Update README.md to point to latest version
Update **Click here if you just want the latest release jar file** on README.md to point to latest version available on Maven Central.
2019-09-06 12:45:41 -03:00
Sean Leary
c3ea0249c9 Merge pull request #481 from johnjaylward/ClarifyParserExceptionsInReadMe
clarifies exception that the parser makes when reading JSON
2019-08-14 11:27:40 -05:00
John J. Aylward
b044b7db4d clarifies exception that the parser makes when reading JSON 2019-08-14 11:47:49 -04:00
Sean Leary
115f8b660b Merge pull request #475 from gaul/static-methods
Make private methods static where possible
2019-08-04 11:18:29 -05:00
Andrew Gaul
f63d21fd13 Make private methods static where possible
This avoids an unneeded object reference.  Found via error-prone.
2019-07-26 15:24:05 -07:00
Sean Leary
c8ae720caf Merge pull request #474 from gaul/stringbuilder
Prefer unsynchronized StringBuilder
2019-07-26 16:07:31 -05:00
Andrew Gaul
4d451468fd Prefer unsynchronized StringBuilder
StringBuffer provides unneeded synchronization.  Found via
error-prone.
2019-07-22 22:26:49 -07:00
Sean Leary
a03a01531a Update README.md 2019-07-22 20:33:02 -05:00
Sean Leary
5b845f28cf Update README.md
New RFC8259, no changes to in-doc references.
2019-05-08 20:27:25 -05:00
Sean Leary
6dcd82a72f Merge pull request #93 from meiskalt7/xsiNilToNull
add test for xsi:nil to null conversion
2019-04-22 08:34:15 -05:00
Sean Leary
00e0e6c0a2 Merge pull request #467 from meiskalt7/addConfigurationForXsiNilConversionToNull
add configuration for xsi:nil="true" conversion to null
2019-04-22 08:33:16 -05:00
meiskalt7
fa173fa51a add test for xsi:nil to null conversion disabled 2019-04-21 00:53:39 +07:00
meiskalt7
614e8359b9 add test for xsi:nil to null conversion 2019-04-18 21:42:57 +07:00
meiskalt7
d5b278539e add configuration for xsi:nil="true" conversion to null 2019-04-09 19:49:32 +07:00
Sean Leary
437ce10ee3 Merge pull request #91 from johnjaylward/FixEOF
Tests for https://github.com/stleary/JSON-java/pull/452
2018-12-13 09:14:39 -06:00
Sean Leary
12bbe8cd9a Merge pull request #452 from johnjaylward/FixEOF
Adds check for EOF
2018-12-13 09:14:10 -06:00
Sean Leary
cfec288fe8 Merge pull request #90 from stleary/tests-for-xml-config
xml parser config tests
2018-12-11 07:27:04 -06:00
Sean Leary
09dddb826e Merge pull request #412 from johnjaylward/XmlConfig
Initial implementation of XMLParserConfig object for flexible XML Parsing
2018-12-11 07:26:50 -06:00
John J. Aylward
19e9bb6c07 Adds check for EOF 2018-12-10 11:45:53 -05:00
John J. Aylward
e7f7d348cd * updates tests to cover more cases of tokenizing
* uncomments tests that should now work
2018-12-10 11:45:10 -05:00
Sean Leary
e699abb1c6 Merge pull request #61 from johnjaylward/XmlEscape
Test cases Xml escapes
2018-12-08 20:09:03 -06:00
Sean Leary
fea0aca2ab Update README.md 2018-12-08 19:54:06 -06:00
stleary
d0ea807884 xml parser config tests 2018-12-08 14:51:01 -06:00
Sean Leary
0d053a000d Merge pull request #89 from stleary/update-timeNumberParsing-iterations
reduce number of iterations to shorten test time
2018-12-08 11:31:38 -06:00
stleary
e4186e072a reduce number of iterations to shorten test time 2018-12-08 11:29:44 -06:00
Sean Leary
4c64ad3d8a Merge pull request #88 from johnjaylward/FixForBigDecimal
Updated testcases for PR440
2018-10-06 14:52:13 -05:00
Sean Leary
1a811f1ada Merge pull request #440 from johnjaylward/FixForBigDecimal
Fixes #438 - Corrections to BigDecimal consistency
2018-10-06 14:51:57 -05: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
34cfe6df14 removes duplicate code in number getters 2018-10-04 16:02:14 -04:00
John J. Aylward
71c6dd1e34 remove unneeded casts 2018-10-02 15:33:33 -04:00
John J. Aylward
30c1bd16ba fix javadoc 2018-10-02 15:28:53 -04:00
John J. Aylward
bc347d2c19 cleanup of minor warnings 2018-10-02 15:28:24 -04:00
John J. Aylward
a63fa03062 * Fixes opt/getBigDecimal to be consistent
* Performance: Updates JSONWriter to use a regex to decide if writing as a number is best.
2018-10-02 15:28:24 -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
Sean Leary
16225efbdd Merge pull request #432 from johnjaylward/patch-2
Update README.md
2018-08-15 08:32:32 -05:00
johnjaylward
b8a3342eb1 Update README.md
update maven search example.
2018-08-15 09:18:14 -04:00
Sean Leary
37f5bf28e9 Update README.md 2018-08-13 20:46:20 -05:00
Sean Leary
7a17ae0b3e Merge pull request #421 from strkkk/add-emptiness-methods
add isEmpty and isNotEmpty methods
2018-05-26 09:56:23 -05:00
Sean Leary
dedb044f67 Merge pull request #86 from strkkk/add-isEmpty-method-usage
add usage of isEmpty method
2018-05-26 09:55:41 -05:00
Andrei Paikin
d00501eabd add usage of isEmpty method 2018-05-25 22:47:05 +03:00
Andrei Paikin
7cad4c3b26 partially revert changes 2018-05-25 22:17:03 +03:00
Andrei_Paikin
05074386d3 change length comparison to isEmpty method 2018-05-21 16:58:13 +03:00
Andrei Paikin
a490ebdb78 add isEmpty and isNotEmpty methods 2018-05-19 09:42:21 +03:00
Sean Leary
3c1535d724 Merge pull request #417 from stleary/fix-double-ctor
fix double ctor in JSONWriter
2018-05-16 08:46:01 -05:00
stleary
a6284df9c7 initial commit 2018-05-02 20:28:45 -05:00
Sean Leary
20d90bfb0b Merge pull request #85 from johnjaylward/JSONPointerTrailingSlash
Test cases for issue described in Issue 410
2018-03-27 07:45:17 -05:00
Sean Leary
bfb300835f Merge pull request #411 from johnjaylward/JSONPointerTrailingSlash
Fix for invalid processing of trailing / for JSON Pointer
2018-03-27 07:44:48 -05:00
John J. Aylward
ca9df04539 Initial implementation of XMLParserConfig object for more flexible XML parsing 2018-03-21 22:09:46 -04:00
John J. Aylward
3fe4a767e6 Fixes incorrect syntax for JSONPointer in test. 2018-03-20 22:15:25 -04:00
Sean Leary
06e9ad280f Merge pull request #403 from paulpolushkin/idea-fix
ignore Intellij Idea project files
2018-03-19 19:10:29 -05:00
John J. Aylward
2362c930d1 Fixes #410. Invalid processing of trailing / for JSON Pointer 2018-03-19 09:57:06 -04:00
John J. Aylward
43f3f5e80b Add another test 2018-03-19 09:49:42 -04:00
John J. Aylward
f4201cf318 Test cases for issue described in https://github.com/stleary/JSON-java/issues/410. 2018-03-19 09:34:13 -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
Sean Leary
2a6b5bacc5 Merge pull request #406 from johnjaylward/FixBeanKeyNameing
Adds annotations to customize field names during Bean serialization
2018-03-14 21:18:23 -05:00
John J. Aylward
a509a28ed4 Cleans up the name check a little to be more permissive on what can be tagged with the new JSONPropertyName annotation.
Also updates the javadoc to reflect the new name allowances
2018-03-11 17:22:05 -04:00
Sean Leary
37f1f4c8ca Merge pull request #83 from johnjaylward/FixNPE
add test cases for null keys
2018-03-11 15:59:21 -05:00
Sean Leary
1c1ef5b211 Merge pull request #405 from johnjaylward/FixNPE
Updates javadoc to match actual exceptions thrown.
2018-03-11 15:57:23 -05:00
John J. Aylward
193a3823b5 new test cases to support bean annotation 2018-03-11 16:56:07 -04:00
John J. Aylward
74b9a60f98 Adds annotation to support custom field names during Bean serialization 2018-03-11 16:28:24 -04:00
John J. Aylward
b63b976acb Updates javadoc to match actual exceptions thrown.
Also optimizes some boxing statements and returns.
2018-03-07 12:35:56 -05:00
John J. Aylward
aa5e80bc8d add test cases for null keys 2018-03-07 12:11:17 -05:00
Pavel Polushkin
97e180444d ignore Intellij Idea project files 2018-02-25 13:08:58 +03:00
Sean Leary
d402a99fd8 Merge pull request #400 from foldvari/master
XML toJSONObject(Reader reader)
2018-02-10 11:09:26 -06:00
György Földvári
7073bc8c47 XML toJSONObject(Readre reader) 2018-02-04 18:43:35 +01:00
Sean Leary
fc881e2631 Merge pull request #82 from billdeng/master
Correct the message to match the function
2018-02-02 23:56:36 -06:00
dengjianbao
cc2ed79e57 Correct the message to match the function 2018-02-02 22:54:08 +08:00
Sean Leary
77d142d494 Merge pull request #81 from johnjaylward/FixFalsePositiveSimilar
Test cases to verify Similar methods
2017-11-11 16:12:26 -06:00
John J. Aylward
dae88d7c5c fix method names 2017-11-06 10:35:49 -05:00
John J. Aylward
08d93f3eb5 test cases for issue https://github.com/stleary/JSON-java/issues/379 2017-11-06 10:27:45 -05:00
Sean Leary
bf26eba0d2 Merge pull request #80 from johnjaylward/UnclosedJSONArray
New test to verify unclosed array
2017-11-02 20:03:00 -05:00
Sean Leary
936db93445 Update README.md 2017-10-30 08:46:43 -05:00
Sean Leary
e0801befe5 Update README.md 2017-10-30 08:45:41 -05:00
Sean Leary
ee3aa03da1 Update README.md 2017-10-30 08:44:21 -05:00
Sean Leary
578a442ef7 Update README.md 2017-10-30 08:43:56 -05:00
John J. Aylward
dfa37a298f Add more tests for unclosed arrays 2017-10-30 08:53:50 -04:00
John J. Aylward
bde6ba1c52 Updates exception expected message 2017-10-30 08:53:50 -04:00
John J. Aylward
52ecc89702 New test to verify unclosed array 2017-10-30 08:53:50 -04:00
Sean Leary
af3b7dc443 Merge pull request #79 from johnjaylward/FixXMLUnescape
New tests for XML unescaping
2017-08-27 10:59:36 -05:00
John J. Aylward
2713f2e2a4 Adds testing for unicode entities 2017-08-19 18:45:53 -04:00
John J. Aylward
cb61bbf720 New tests for XML unescaping 2017-08-19 18:19:22 -04:00
Sean Leary
d0e2cf41a3 Merge pull request #78 from migueltt/tokener-error-message
Unit tests for constructor JSONObject(JSONTokener)
2017-08-17 21:29:13 -05:00
Miguel
b90bee0f22 Update error message location (+1)
`JSONTokener.back()` call removed from `JSONObject(JSONTokener)` constructor.
2017-08-14 13:05:23 -04:00
Miguel
68b262914d JSONObject(JSONTokener) now points to last character of duplicate key
Updating exception message accordingly (position -1)
2017-08-10 19:06:55 -04:00
Miguel
c365e2a774 Remov slf4j reference 2017-08-09 22:03:09 -04:00
Miguel
df466db7b9 Replacing tabs with 4 spaces 2017-08-09 21:59:08 -04:00
Miguel
1acb18091a Remove System.out.println 2017-08-09 21:57:10 -04:00
Miguel
fefd616d73 Unit tests for JSONTokener 2017-08-09 21:51:46 -04:00
Sean Leary
44c3e321b5 Merge pull request #77 from johnjaylward/FixJUnitGradleConfig
Fixes Gradle config so tests are only run once
2017-07-20 06:51:14 -05:00
John J. Aylward
f2f6ad3b1f * Fixes Gradle config so tests are only run once
* Adds missing test to the test suite
2017-07-19 20:34:59 -04:00
Sean Leary
cf411b3187 Merge pull request #75 from johnjaylward/PopulateMapMoreStrict
Populate map more strict
2017-07-19 18:57:55 -05:00
Sean Leary
1aeadd1765 Merge pull request #76 from johnjaylward/WriteJavadocUpdate
Update test for issue https://github.com/stleary/JSON-java/issues/356
2017-07-15 18:46:58 -05:00
John J. Aylward
aa562b5ec3 Update test for issue https://github.com/stleary/JSON-java/issues/356 2017-07-15 12:19:02 -04:00
John J. Aylward
38d11227ee Adds exception tests 2017-07-09 19:05:00 -04:00
John J. Aylward
e94783f91b Updates javadocs 2017-07-09 18:19:27 -04:00
John J. Aylward
7bc8f41023 Add override of the generic getter to generate a Bridge method. 2017-07-09 18:10:09 -04:00
John J. Aylward
49117f33dc Adds new tests for testing bean->JSONObject mapping 2017-07-09 17:57:46 -04:00
John J. Aylward
0e3f23d7a1 reorganize classes so test data is separate from test cases 2017-07-09 16:48:01 -04:00
Sean Leary
974a5f7d5d Merge pull request #74 from johnjaylward/AndroidSupport
Correct expected position information in error messages
2017-07-06 18:08:20 -05:00
John J. Aylward
899cf528df More test cases for position information 2017-06-24 13:10:14 -04:00
John J. Aylward
47ff774f5c Updates test coverage table 2017-06-23 23:55:22 -04:00
John J. Aylward
af39376d92 more fixes for testing postition information 2017-06-23 23:25:11 -04:00
John J. Aylward
0e612ba8a4 More test corrections for correct position reports in error messages 2017-06-21 19:56:00 -04:00
John J. Aylward
971614ac8b fix expected exception message 2017-06-21 18:28:04 -04:00
John J. Aylward
3081b4bd96 Fixes for failing tests due to android integration 2017-06-21 14:59:42 -04:00
Sean Leary
441fec7498 Merge pull request #73 from johnjaylward/BetterErrorHandling
Updates tests for better error handling changes
2017-06-11 14:12:56 -05:00
John J. Aylward
c5e4b91fa4 Updates tests for better error handling changes 2017-06-08 02:25:59 -04:00
Sean Leary
93ca7b176f Merge pull request #71 from johnjaylward/OptimizeOpt
Adjustments to tests for https://github.com/stleary/JSON-java/pull/337
2017-05-22 22:59:37 -05:00
Sean Leary
f5d3086c55 Merge pull request #70 from johnjaylward/fixSpelling
test support for Numeric enhancements, Refactoring, Fix spelling:  stleary/JSON-java/pull/336
2017-05-20 12:37:58 -05:00
John J. Aylward
04d76b638b split out tests for better readability 2017-05-19 15:01:37 -04:00
John J. Aylward
cfe6851d8c Adds testing for -0 with optNumber 2017-05-18 14:25:42 -04:00
John J. Aylward
1967bee236 expands the coercion tests a little more 2017-05-18 12:11:43 -04:00
John J. Aylward
0150639119 update the new coercion test to use actual values and show the parseDouble method is not robust enough for large numbers 2017-05-18 11:58:28 -04:00
John J. Aylward
bdb1163445 Adds conversion tests to ensure downward type coercions are handled sanely 2017-05-18 11:38:42 -04:00
John J. Aylward
2867aaa8c8 Updates test cases to support new optFloat and optNumber 2017-05-17 12:33:59 -04:00
John J. Aylward
49d47e3ff2 Adjustments to tests for https://github.com/stleary/JSON-java/pull/337/ 2017-05-16 19:42:46 -04:00
John J. Aylward
1d040ec407 fixes errors with tests relating to https://github.com/stleary/JSON-java/pull/336 2017-05-16 18:16:07 -04:00
Sean Leary
c945b53308 Merge pull request #69 from johnjaylward/TestCleanup
Couple of the files were difficult to identify the changes, but it was worth it to add the new tests. Thanks!!!
2017-04-28 01:04:56 -05:00
John J. Aylward
c233ae709e comment out second unreliable test 2017-04-27 12:52:02 -04:00
John J. Aylward
95da4246a2 fix spelling in comment 2017-04-27 12:48:43 -04:00
John J. Aylward
9df5d34bbe * Update link in the README to the main JSON-Java repo
* Cleans up some warnings
* Adds new test for bug https://github.com/stleary/JSON-java/issues/332
* Adds some resource handling for string writers using pre-java1.7
support. I know StringWriters don't need a close method called, but the
tests should still handle their resources properly.
2017-04-27 12:39:42 -04:00
Sean Leary
f6ab6d7b27 Merge pull request #68 from stleary/jsonpointer-query
unit tests for query-by-JSONPointer
2017-03-27 20:05:05 -05:00
stleary
d1a5f15f0c unit tests for query-by-JSONPointer 2017-03-26 15:03:09 -05:00
Sean Leary
82ff14ed8d Merge pull request #66 from stleary/document-unquoted-strings
add a test for unquoted values
2017-02-26 11:10:38 -06:00
stleary
e41972a574 add a test for unquoted values 2017-02-26 11:09:41 -06:00
Sean Leary
a66abf22a8 Merge pull request #64 from stleary/locale-tests-for-non-EN-keys
Locale tests for non en keys
2017-02-19 21:34:40 -06:00
stleary
f41e1d012a tests for locale-independent keys 2017-02-16 20:49:37 -06:00
stleary
928179a1f3 locale tests 2017-02-14 08:30:22 -06:00
Sean Leary
df9c27c53f Merge pull request #62 from erosb/master
testcase for stleary/JSON-java#292
2016-10-08 10:07:53 -05:00
Bence Erős
97e3d6c7ce testcase for stleary/JSON-java#292 and adding .idea to .gitiignore 2016-10-05 14:59:36 +02:00
John J. Aylward
f6a00e94c7 adds test for unicode that has surrogate pairs 2016-09-22 16:12:00 -04:00
John J. Aylward
2b87f334d0 Update test cases to support ISO Control encoding changes. 2016-09-22 14:13:48 -04:00
John J. Aylward
5027a283c1 Adds test for escaping from a JSONObject to XML 2016-09-22 13:09:32 -04:00
John J. Aylward
c8563ff93d new test case for XML changes 2016-09-22 12:38:30 -04:00
Sean Leary
474711c4ea Merge pull request #60 from stleary/fix-number-tests
fixed merge issues
2016-09-15 21:38:36 -05:00
stleary
58aebaa14f fixed merge issues 2016-09-15 21:31:28 -05:00
Sean Leary
3570890be7 Merge pull request #57 from johnjaylward/EnumCleanup
test updates to make sure Enums are handled consistently.
2016-08-19 11:43:20 -05:00
Sean Leary
59761f6f64 Merge pull request #58 from johnjaylward/SimplifyNumberWrap
Adds tests for numbers
2016-08-17 12:12:32 -05:00
John J. Aylward
0b1dbe9369 fixes test to not depend on key order 2016-08-17 12:15:16 -04:00
John J. Aylward
a66b97f60b fix test 2016-08-17 11:31:44 -04:00
johnjaylward
cbd0418704 Update JSONObjectTest.java
fixes test to be applicable
2016-08-16 21:33:54 -04:00
John J. Aylward
bbd3fd5571 Adds tests for numbers 2016-08-16 20:52:41 -04:00
John J. Aylward
5779400f26 test updates to make sure Enums are handled consistently. 2016-08-11 12:21:49 -04:00
Sean Leary
c400de3cfe Merge pull request #53 from run2000/master
valueToString() and write() tests
2016-08-10 21:55:33 -05:00
Sean Leary
a418d07460 Merge pull request #55 from johnjaylward/verifyOptMissingKeys
Updates tests to include all opt methods and verify for missing keys.
2016-08-10 09:04:27 -05:00
John J. Aylward
8bae09f81b removes unnecessary comparison to true 2016-08-09 16:11:46 -04:00
John J. Aylward
80e36eb63c Fixes error messages 2016-08-09 15:59:27 -04:00
John J. Aylward
a2c311527b Updates tests to include all opt methods and verify for missing keys. 2016-08-09 15:54:06 -04:00
Sean Leary
62524b531d Merge pull request #52 from johnjaylward/OptionalTypeConversion
updates Test cases to support new JSONML and XML conversion options
2016-07-31 21:09:34 -05:00
run2000
e57881f8fa Fail when exceptions are not thrown as expected
The idiom was started in the first few methods, but not continued further down where JSONException was expected. False success may have resulted.
2016-07-25 09:44:43 +10:00
Nicholas Cull
efe33a1e37 Fix comment. 2016-07-24 19:57:01 +10:00
Nicholas Cull
1246e12827 Factor out Writer from Appendable tests. 2016-07-24 19:39:52 +10:00
Nicholas Cull
ffcfa66d77 Add JSONString test class.
This set of tests demonstrates what happens when JSONString returns various results from its toJSONString() method. Tests for null returns and exceptions thrown. Also tests what happens for non-JSONString objects. The intent is to cover JSONObject's valueToString() and writeValue() methods.
2016-07-24 18:56:08 +10:00
Sean Leary
5d8ea6fa4e Update README.md 2016-07-23 10:13:21 -05:00
Sean Leary
cdfdaba95b Update README.md 2016-07-23 10:12:33 -05:00
Sean Leary
2307f6f85e Update README.md 2016-07-23 10:12:04 -05:00
Sean Leary
6b4edbd40c Update README.md 2016-07-23 10:02:19 -05:00
Nicholas Cull
ae77b5cd83 Tests for deep copy and mutability of toList() and toMap().
Both toMap() and toList() return deep copies, which are also mutable. That is, any changes to the JSONObject or JSONArray do not affect the newly create Map or List, and vice-versa. The resulting objects can be altered.
2016-07-23 22:51:50 +10:00
Nicholas Cull
72c2b911bf Tests for toString(), write(), toList(), and toMap().
Explicitly test variations of toString() and write() for different indent levels, and different method overloads. Also create some tests for the new toList() and toMap() methods for coverage improvements to JSONArray and JSONObject.
2016-07-23 22:33:19 +10:00
Nicholas Cull
c3ba4bdbe5 Nesting depth test works as expected. 2016-07-23 19:12:51 +10:00
John J. Aylward
215321cd28 updates Test cases to support new JSONML and XML conversion options 2016-07-18 15:04:03 -04:00
Sean Leary
71c1eba1e7 Merge pull request #51 from johnjaylward/VerifyOptConversions
Verify opt method conversions for JSONArray and JSONObject
2016-07-08 22:31:48 -05:00
John J. Aylward
c2de224711 Verify opt method conversions for JSONArray and JSONObject 2016-07-08 16:58:58 -04:00
Sean Leary
01af31718e Merge pull request #50 from johnjaylward/issue240
Tests for Issue #240 in JSON-Java
2016-06-17 09:36:42 -05:00
John J. Aylward
1204ea9dcf fixes a typo 2016-06-17 00:04:27 -04:00
John J. Aylward
c5deff636b updates README for new project layout 2016-06-16 23:59:34 -04:00
John J. Aylward
46a1c9acf9 Adds test case to confirm the parsing of control characters 2016-06-16 13:02:08 -04:00
John J. Aylward
80f9e48e64 Moves src folder to simplify build.gradle configuration. If JSON-Java source is merged, it's src fold would now be src/main/java/org.json/ instead of src/main/org.json as well. 2016-06-16 12:20:54 -04:00
johnjaylward
0e0f3f2167 Merge pull request #1 from stleary/master
update from origin
2016-06-16 11:44:09 -04:00
Sean Leary
40f170b508 Merge pull request #49 from madsager/master
Add test that an invalid escape sequence results in a JSONException a…
2016-06-07 21:29:25 -05:00
Mads Ager
c7fdada0fd Add test that an invalid escape sequence results in a JSONException and not a NumberFormatException. 2016-06-02 16:41:43 +02:00
Sean Leary
51bcbebaa8 Merge pull request #48 from erosb/master
unittests for stleary/JSON-Java#233
2016-05-20 21:12:12 -05:00
Bence Erős
a1893ebc02 unittests for stlear/JSON-Java#233 2016-05-16 14:54:01 +02:00
stleary
8ed0362683 convert remaining JsonPath expressions to JSONPointer 2016-05-14 13:38:46 -05:00
stleary
15f48a0500 convert tests to use JSONPointer where practical 2016-05-14 11:59:24 -05:00
stleary
45cbc66f5b add coverage for JSONObject, JSONArray queryFrom() 2016-05-14 09:26:03 -05:00
stleary
06ae87c456 exclude resources from test 2016-05-13 23:22:54 -05:00
Sean Leary
7038ea884e Merge pull request #47 from stleary/add-to-test-suite-and-fix-resource
add JSONPointerTest to test suite, fix resource for gradle build
2016-05-13 23:17:10 -05:00
stleary
0112d82755 add JSONPointerTest to test suite, fix resource for gradle build 2016-05-13 23:13:06 -05:00
Sean Leary
46044bfc51 Merge pull request #46 from erosb/master
Tests for JSON Pointers
2016-05-13 22:47:14 -05:00
Sean Leary
a9ff159c78 Update README.md 2016-05-13 15:17:22 -05:00
Sean Leary
b843d67a92 Update README.md 2016-05-07 07:03:50 -05:00
Sean Leary
691734f342 Update README.md 2016-05-07 07:03:30 -05:00
Sean Leary
ccc7a7af29 Update README.md 2016-05-07 07:02:50 -05:00
Bence Erős
adb3118d31 added test for checking if the JSONPointer is immutable 2016-05-05 16:00:15 +02:00
Bence Erős
2eed4be5fc one more test for null-check in Builder#append(String) 2016-05-03 23:42:26 +02:00
Bence Erős
6edc093803 adding unittests for JSPONPointer#toString(), toURIFragment() and its builder class 2016-05-03 23:20:17 +02:00
Sean Leary
77d0873abd Merge pull request #45 from captainIowa/master
Added unit tests for escaped quotes.
2016-05-01 22:55:49 -05:00
Sean Leary
052ce94a34 Update README.md 2016-05-01 22:53:53 -05:00
stleary
4a3565afb3 unit test integration 2016-05-01 22:47:23 -05:00
Bence Erős
e748c60eb1 tests for improved failure handling 2016-04-26 23:31:43 +02:00
Bence Erős
f857dda5d8 removing some deprecated commented code 2016-04-26 23:03:01 +02:00
Bence Erős
66f740eb45 rolling back unwanted gitignore change in previous commit 2016-04-26 23:02:26 +02:00
Bence Erős
6211384f87 tests for url fragment notation handling, moving test document to separate file 2016-04-26 23:01:18 +02:00
Brian Russell
e00191798e Added unit tests for escaped quotes. 2016-04-24 23:04:12 -04:00
Bence Erős
9c47ba299d initial test for JSONPointer class 2016-04-18 21:49:14 +02:00
Sean Leary
8f16e065c5 Merge pull request #39 from johnjaylward/FixNegativeZero
Fix negative zero
2016-01-30 15:47:06 -06:00
John J. Aylward
974c09b22a Fixes typo in assert 2016-01-27 15:02:37 -05:00
John J. Aylward
bd958e0830 fixes formatting 2016-01-27 11:36:15 -05:00
John J. Aylward
67d888e9be Adds test cases to verify that -0 and -0.0 are processed as Double 2016-01-27 11:32:11 -05:00
Sean Leary
d3b197b1b9 Merge pull request #37 from stleary/move-files-to-maven-friendly-dirs
Move files to maven friendly dirs. Hope it works...
2016-01-05 20:46:43 -06:00
stleary
706d898648 latest 2016-01-03 21:39:44 -06:00
stleary
ace08f1944 latest 2016-01-03 21:39:30 -06:00
stleary
280ce71285 tabs to spaces 2016-01-01 13:54:47 -06:00
Sean Leary
147343c51b Merge pull request #29 from johnjaylward/HandleArraysConsistently
Add tests to verify arrays are handled consistently.
2016-01-01 13:46:02 -06:00
Sean Leary
dc8c9e382d Merge pull request #35 from stleary/more-todo-cleanup
clean up a few more todos
2015-12-30 13:52:55 -06:00
stleary
871a3e46d7 clean up a few more todos 2015-12-30 13:50:51 -06:00
Sean Leary
4df6984233 Merge pull request #34 from stleary/util-cleanup
util cleanup
2015-12-30 01:03:31 -06:00
stleary
c88d06eede util cleanup 2015-12-30 01:01:43 -06:00
Sean Leary
0dc886d11b Merge pull request #33 from stleary/Fix-todos-and-cleanup
Fix some todos, clean up some tests, improve coverage
2015-12-30 00:03:37 -06:00
stleary
fc318a765c Fix some todos, clean up some tests, improve coverage 2015-12-30 00:00:58 -06:00
Sean Leary
0990f340db Update README.md 2015-12-30 00:00:14 -06:00
Sean Leary
4ddd6a19a7 Merge pull request #32 from stleary/refactor-test-classes-from-JSONObjectTest
refactor test classes to their own modules
2015-12-29 18:01:35 -06:00
stleary
7f83a51718 refactor test classes to their own modules 2015-12-29 17:56:43 -06:00
Sean Leary
95cf86688d Update README.md 2015-12-28 12:25:40 -06:00
Sean Leary
91fcd6092f Update README.md 2015-12-28 12:25:11 -06:00
Sean Leary
54cd97ded1 Update README.md 2015-12-28 12:24:46 -06:00
Sean Leary
633ab108e7 Update README.md 2015-12-28 12:22:29 -06:00
Sean Leary
472439546a Update README.md 2015-12-28 12:20:43 -06:00
Sean Leary
cfec741090 Merge pull request #31 from stleary/json-path-for-validation
Replace util compare method with JsonPath
2015-12-28 12:11:47 -06:00
stleary
abe421e6bb clean up code 2015-12-28 12:07:44 -06:00
stleary
48c872f66f Replace util compare method with JsonPath 2015-12-28 11:12:41 -06:00
stleary
7187006bae Replace util compare method with JsonPath 2015-12-27 17:01:42 -06:00
stleary
d329b6514c Replace util compare method with JsonPath 2015-12-27 15:17:01 -06:00
stleary
a5390a0685 Replace util compare method with JsonPath 2015-12-26 19:02:02 -06:00
stleary
c6204a9f01 Replace util compare method with JsonPath 2015-12-26 13:21:06 -06:00
Sean Leary
c578216844 Merge pull request #30 from stleary/confirmValueToStringFix
Fix tabs, add valueToString() test to JSONObjectTest
2015-10-31 04:00:52 -05:00
stleary
38cbc31624 Fix tabs, add valueToString() test to JSONObjectTest 2015-10-31 03:58:04 -05:00
Sean Leary
6406c7a379 Merge pull request #28 from johnjaylward/FixCtorGenerics
Test cases for PR #153 in JSON-Java
2015-10-29 18:08:21 -05:00
John J. Aylward
3850b5fd25 Add tests to verify arrays are handled consistently. 2015-10-26 18:35:53 -04:00
Sean Leary
0dbd9be0f1 Merge pull request #26 from johnjaylward/FixXMLNPE
Fixes NPE in XML for pull request #160 in the json-java project
2015-10-18 10:45:42 -05:00
John J. Aylward
4a2f9b8cd3 Adds test cases for corrected generic constructors and put methods 2015-10-14 15:15:24 -04:00
John J. Aylward
cb63a968fa fixes test case to validate the input/output of the function being tested 2015-10-12 14:49:18 -04:00
John J. Aylward
4b0db65877 Fixes NPE in XML 2015-10-12 14:33:43 -04:00
stleary
1a5718dc39 Commenting out some code until JSON-java supports XML.toJSONObject(Reader) 2015-09-27 23:55:32 -05:00
Sean Leary
3f78a85908 Merge pull request #22 from stleary/xml-reader-remote
sample tests for XML.toJSONObject(Reader)
2015-08-23 20:08:02 -05:00
Sean Leary
9dd0ca7b81 Merge pull request #23 from seanThomasLeary/master
Update README.md
2015-08-23 18:54:54 -05:00
seanThomasLeary
045fc74688 Update README.md 2015-08-23 18:54:10 -05:00
stleary
1f6e07c914 sample tests for XML.toJSONObject(Reader) 2015-08-19 19:16:22 -05:00
stleary
8f71e01ae3 Add method comments so JavaDoc will pick them up. 2015-08-09 18:30:16 -05:00
stleary
ccbec8127c Added some class documentation 2015-08-09 18:24:47 -05:00
stleary
1081ae092b Move method comments so JavaDoc will pick them up. 2015-08-09 18:19:51 -05:00
stleary
58d72fe20f Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-09 18:19:32 -05:00
stleary
8e48caeb3d Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-08 15:12:20 -05:00
stleary
4a3bbedc32 Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-08 14:09:52 -05:00
stleary
41bfdad91f Move method comments so JavaDoc will pick them up. 2015-08-08 12:10:52 -05:00
stleary
6f5bcb32e5 Unit tests for JSON-Java HTTP.java. See RFC7230 2015-08-08 12:10:18 -05:00
stleary
9ce62b9540 Move method comments so JavaDoc will pick them up. 2015-08-08 10:30:20 -05:00
stleary
f66cc8d5c4 Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-08 10:22:17 -05:00
stleary
a0108f3e8e Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-08 09:32:15 -05:00
stleary
ee0a53d494 Verify exception messages. Move method comments so JavaDoc will pick them up. 2015-08-08 08:13:22 -05:00
stleary
f69466f4c2 recreate original documented issue 2015-07-22 21:21:23 -05:00
stleary
1f4e836863 few more enum support tests 2015-07-22 20:24:45 -05:00
stleary
8ac8c34e9f tests for enum-support 2015-07-22 20:12:10 -05:00
stleary
ec7eb25565 Merge branch 'master' of github.com:stleary/JSON-Java-unit-test 2015-07-22 19:47:38 -05:00
stleary
4e38ed01e5 tests for enum-support 2015-07-22 19:47:12 -05:00
Sean Leary
752f66746b Update README.md 2015-07-21 09:12:16 -05:00
stleary
0361cc58d6 one more test - and a bug? 2015-07-20 23:31:52 -05:00
stleary
b39c3df766 document behavior of content keyword 2015-07-20 23:14:15 -05:00
stleary
b9c6f335ee fixed comment location 2015-07-19 09:04:10 -05:00
stleary
f48b6439f6 manual merge of pull request #18 2015-07-19 09:02:27 -05:00
stleary
2c026eb5f8 Fixed test shouldHandleIllegalJSONNodeNames 2015-07-19 08:56:20 -05:00
Sean Leary
0d2d0e3f6c Merge pull request #19 from JaXt0r/illegal_JSON-node-names_during_conversion_to_XML
Showing issue of illegal node names with possible underscore-replacement. (Will currently assterted to an Exception).
2015-07-19 08:48:32 -05:00
JaXt0r
5eadebb797 Showing issue of illegal node names with possible underscore-replacement. (Will currently assterted to an Exception). 2015-07-19 14:24:06 +02:00
stleary
16fa69c0f6 investigate XML.toString() behavior with null JSONObject values 2015-07-17 22:04:01 -05:00
stleary
b06182cb73 investigate XML.toString() behavior with null JSONObject values 2015-07-17 22:01:52 -05:00
stleary
0056b1af94 investigate XML.toString() behavior with null JSONObject values 2015-07-17 21:58:42 -05:00
stleary
6cca292020 investigate XML.toString() behavior with null JSONObject values 2015-07-17 21:55:50 -05:00
Sean Leary
ab143af146 Update README.md 2015-07-07 23:20:55 -05:00
Sean Leary
27b22b4724 Update README.md 2015-07-07 23:19:37 -05:00
Sean Leary
7ed1f78f5f Update README.md 2015-07-07 23:18:31 -05:00
Sean Leary
6dd85ad5b6 Update README.md 2015-07-07 23:16:18 -05:00
Sean Leary
99927c5516 Update README.md 2015-07-07 23:15:06 -05:00
Sean Leary
3de0a0a70e Update README.md 2015-07-07 23:13:59 -05:00
Sean Leary
e056fc0881 Update README.md 2015-07-06 22:33:52 -05:00
stleary
355e832337 latest 2015-07-06 22:31:48 -05:00
stleary
6c48db010f bigInt and bigDec behavior 2015-06-20 23:35:48 -05:00
stleary
8c1a0c47b7 fixed test comment 2015-06-17 20:18:51 -05:00
Sean Leary
d27bf852e6 Merge pull request #16 from stleary/big-numbers
Document bigInt and bigDec behavior to determine what can be changed
2015-06-17 20:11:19 -05:00
stleary
c5173e7cc3 ip 2015-06-17 20:09:31 -05:00
stleary
9a9973c9ca Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test into more-numbers 2015-06-17 03:01:22 -05:00
stleary
0640856462 unexpected double behavior 2015-06-17 02:59:43 -05:00
Sean Leary
cb7b602f35 Update README.md 2015-06-13 14:53:43 -05:00
Sean Leary
44f98e6a13 Update README.md 2015-06-13 13:30:06 -05:00
stleary
994a19b831 Merge branch 'master' of github.com:stleary/JSON-Java-unit-test into continue-unit-testing 2015-06-07 22:22:51 -05:00
stleary
56aa2f8607 ongoing unit test improvement 2015-06-07 22:22:42 -05:00
stleary
9cf532828d confirm current behavior 2015-06-07 22:22:14 -05:00
Sean Leary
a5b00a5244 Merge pull request #14 from stleary/iterable-JSONArray
test iterable JSONArray
2015-06-07 10:52:51 -05:00
stleary
969e2d4fd5 test iterable 2015-06-04 22:29:55 -05:00
Sean Leary
f6bdc908d8 Update README.md 2015-06-03 22:55:35 -05:00
Sean Leary
67a0c734b6 Update README.md 2015-06-03 22:54:12 -05:00
Sean Leary
86f4bda2d4 Merge pull request #13 from stleary/enum-support
support enum testing
2015-06-03 22:52:38 -05:00
stleary
6b03f1bbe7 support enum testing 2015-06-03 22:50:08 -05:00
stleary
32ea7e0ba3 tests should succeed 2015-05-28 20:43:47 -05:00
Sean Leary
e9ea5ca98f Merge pull request #12 from FritzMock/master
Hidden typecast for Float objects in JSONobject.increment(String key)
2015-05-28 20:21:09 -05:00
dieter
fa79826f0c Better show what has to be expected and what goes wrong 2015-05-27 16:33:42 +02:00
dieter
88756c0490 Hidden typecast for Float objects in JSONobject.increment(String key) 2015-05-27 15:51:30 +02:00
Sean Leary
dc7c59b23b Merge pull request #11 from stleary/fix-JSONObjectTest
fix so numeric behavior is documented but tests succeed
2015-05-24 23:40:02 -05:00
stleary
60e84bff92 fix so numeric behavior is documented but tests succeed 2015-05-24 23:36:48 -05:00
Sean Leary
c72ac516a0 Merge pull request #10 from FritzMock/master
Playing numbers
2015-05-24 17:33:38 -05:00
dieter
327c0e177e Playing numbers 2015-05-22 12:47:28 +02:00
Sean Leary
a9dd8e7b1d Update README.md 2015-05-09 15:26:15 -05:00
stleary
481ecd7964 Merge branch 'master' of github.com:stleary/JSON-Java-unit-test 2015-05-09 15:25:21 -05:00
stleary
f2ef541c2d still in progress, 94% coverage 2015-05-09 15:25:06 -05:00
Sean Leary
0a995318e7 Delete MyBean.java 2015-05-09 15:24:21 -05:00
Sean Leary
fb36918d85 Update README.md 2015-05-08 23:30:41 -05:00
stleary
fcb8048038 deepened the testing a little bit, slow going 2015-05-07 23:04:44 -05:00
stleary
49d4985828 More trickery from the bean 2015-05-07 23:04:26 -05:00
stleary
ad440b4f11 Merge branch 'master' of github.com:stleary/JSON-Java-unit-test 2015-05-06 22:17:27 -05:00
stleary
95b8cd5b03 test improvements, in progress 2015-05-06 22:16:08 -05:00
Sean Leary
fbd07da05a Update README.md 2015-05-06 14:37:52 -05:00
stleary
6195bd248b added unit tests for suppress warning coverage 2015-05-05 21:53:51 -05:00
Sean Leary
43396cf603 Merge pull request #6 from stleary/JSONMLTest-for-toString-issue
Jsonml test for to string issue
2015-05-02 14:19:16 -05:00
Sean Leary
31614fe826 Update README.md 2015-04-27 15:01:27 -05:00
Sean Leary
31cadbd810 Merge pull request #7 from stleary/Rework-CookieListTest
Rework cookie list test
2015-04-27 14:56:59 -05:00
stleary
912350ec75 96.5% coverage 2015-04-27 14:56:01 -05:00
stleary
65ae3e663f Improving test case quality 2015-04-27 10:04:41 -05:00
Sean Leary
f115d6a3b8 Update README.md 2015-04-26 17:53:39 -05:00
Sean Leary
ee06176ab2 Update README.md 2015-04-26 17:49:04 -05:00
stleary
da2e548f56 98.9% coverage 2015-04-26 17:46:52 -05:00
Sean Leary
d2e19cc78c Update README.md 2015-04-24 16:40:42 -05:00
Sean Leary
571b1a79bb Update README.md 2015-04-24 00:27:34 -05:00
Sean Leary
3112e32089 Update README.md 2015-04-24 00:26:26 -05:00
Sean Leary
102d273be3 Update README.md 2015-04-24 00:25:53 -05:00
Sean Leary
15b5306f48 Update README.md 2015-04-23 22:01:33 -05:00
stleary
9f500c242c Merge branch 'master' of github.com:/stleary/JSON-Java-unit-test 2015-04-23 21:47:28 -05:00
stleary
9bca907208 added JSONArrayTest 2015-04-23 21:47:15 -05:00
Sean Leary
890fd4a397 Update README.md 2015-04-23 21:46:13 -05:00
stleary
30c86811c0 improved object comparison 2015-04-23 21:42:04 -05:00
stleary
5acbee2719 98% coverage 2015-04-23 21:41:46 -05:00
stleary
35a4fefd2e test JSONML.toString(JSONArray) 2015-04-19 17:11:51 -05:00
stleary
f0d175c5b2 Added JSONArrayTest 2015-04-19 17:11:05 -05:00
stleary
9df929963f added a trivial XML string compare method - still needs work 2015-04-19 17:10:47 -05:00
Sean Leary
d9e04ec5b6 Update README.md 2015-04-14 11:01:29 -05:00
Sean Leary
9e78cfc48d Update README.md 2015-04-14 11:00:42 -05:00
Sean Leary
0409c9bfb2 Update README.md 2015-04-14 10:59:19 -05:00
stleary
d75a96ae59 95.9% coverage 2015-04-14 01:12:08 -05:00
Sean Leary
e5c01e4ff8 Update README.md 2015-04-13 22:29:27 -05:00
Sean Leary
98cdaf6a39 Update README.md 2015-04-13 22:28:57 -05:00
Sean Leary
67fbfa12ea Update README.md 2015-04-13 22:27:48 -05:00
Sean Leary
9bffd5b3ca Update README.md 2015-04-13 22:25:13 -05:00
Sean Leary
51e8a2d1e5 Update README.md 2015-04-13 21:45:31 -05:00
stleary
76c30539cc 95.9% coverage 2015-04-13 21:39:26 -05:00
stleary
46a43b7b0d Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-04-12 23:34:45 -05:00
stleary
6a2c974581 90.9% coverage 2015-04-12 23:34:23 -05:00
Sean Leary
a857869522 Update README.md 2015-04-12 19:36:01 -05:00
Sean Leary
9835285f0c Update README.md 2015-04-12 19:35:34 -05:00
stleary
c4d9a9c5f9 90.8% coverage 2015-04-12 19:29:32 -05:00
stleary
dcaf5fa23a ip 2015-04-10 19:42:34 -05:00
stleary
2784c614d4 ip 2015-04-10 08:21:09 -05:00
stleary
bef37079dc in progress 2015-04-09 18:02:45 -05:00
stleary
a9bce1d6b2 in progress 2015-04-08 22:23:39 -05:00
stleary
22d5fd3aed in progress 2015-04-06 19:01:54 -05:00
Sean Leary
2219b5919b Update README.md 2015-04-04 14:05:06 -05:00
stleary
8168e6f52a 93.8% coverage 2015-04-04 14:01:52 -05:00
stleary
b2e0a77ae0 98.7% coverage 2015-04-04 14:01:29 -05:00
stleary
2db11cd4db add JSONStringerTest 2015-04-04 14:00:57 -05:00
Sean Leary
03d1f0af72 Update README.md 2015-04-03 19:18:13 -05:00
Sean Leary
702a918271 Update README.md 2015-04-03 19:16:45 -05:00
stleary
76cb83643d add http test 2015-04-03 19:12:41 -05:00
stleary
400bbd7fbf 98.7% coverage 2015-04-03 19:12:15 -05:00
stleary
837b7c3037 Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-04-03 14:47:12 -05:00
stleary
f7b51414b8 96.5% coverage 2015-04-03 14:46:51 -05:00
Sean Leary
83ac581f3d Update README.md 2015-04-03 14:46:45 -05:00
stleary
970e7a45a9 added cookielisttest 2015-04-03 14:36:40 -05:00
stleary
519c21c8b0 96.5% coverage 2015-04-03 14:36:18 -05:00
stleary
3406acd0aa 97.5% coverage 2015-04-03 14:35:59 -05:00
Sean Leary
ac8b1b098a Update README.md 2015-04-03 11:29:16 -05:00
stleary
5ee4a3fc12 fixed comment test 83.2% coverage 2015-04-02 21:44:35 -05:00
stleary
5fc222229f Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-04-02 21:42:11 -05:00
stleary
e80ded6ebe fixed comment test 83.2% coverage 2015-04-02 21:31:15 -05:00
Sean Leary
45d7503e24 Update README.md 2015-04-01 01:23:04 -05:00
stleary
de13c7de86 coverage 84.9% 2015-04-01 01:12:22 -05:00
stleary
9a6215c3be in progress 2015-03-31 22:53:52 -05:00
stleary
ef7e0c7d08 in progress 2015-03-30 08:14:34 -05:00
stleary
bc07b5196b starting jsonml test 2015-03-27 17:52:41 -05:00
Sean Leary
1ff945de69 Update README.md 2015-03-26 23:05:59 -05:00
Sean Leary
210bb41ba1 Update README.md 2015-03-26 23:05:07 -05:00
stleary
89f359e4f8 coverage XMLTest 81.2% / XMLTokener 82.2% 2015-03-26 22:58:11 -05:00
stleary
a18e9f7a25 in progress 2015-03-25 18:53:52 -05:00
stleary
2df27fc6e7 in progress 2015-03-25 08:27:29 -05:00
stleary
4c6da0e6f9 In progress 2015-03-23 19:23:22 -05:00
stleary
4fbe651e57 XMLTest, in progress 2015-03-22 20:37:24 -05:00
stleary
8b9c3cbf47 XMLTest, in progress 2015-03-22 20:36:55 -05:00
stleary
964cb540fb completed 94.8% coverage 2015-03-22 17:59:43 -05:00
Sean Leary
2876b27ec5 Update README.md 2015-03-22 17:48:21 -05:00
stleary
407e7fb8d6 Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-03-21 13:44:48 -05:00
stleary
30c31db095 Reverting to 4a5809910b until I have figured out the best way to refactor the code 2015-03-21 13:44:29 -05:00
stleary
231c3de79e Update README.md 2015-03-21 13:41:25 -05:00
stleary
d0223c2d08 Update README.md 2015-03-21 13:35:24 -05:00
stleary
25596c9578 Update README.md 2015-03-21 13:34:04 -05:00
stleary
e4ef254d8f Update README.md 2015-03-21 13:33:12 -05:00
stleary
e4ebd8c443 Update README.md 2015-03-21 13:32:47 -05:00
stleary
f8c37b1e05 Update README.md 2015-03-21 13:27:38 -05:00
stleary
e150039261 Update README.md 2015-03-21 13:23:49 -05:00
stleary
8374382947 Update README.md 2015-03-21 13:22:54 -05:00
stleary
2b0a9cc7c8 Update README.md 2015-03-21 13:19:58 -05:00
stleary
42ad66b032 Update README.md 2015-03-21 13:19:32 -05:00
stleary
09b5562ad9 Update README.md 2015-03-21 13:18:56 -05:00
stleary
b0ce7f3bd9 Update README.md 2015-03-21 13:15:46 -05:00
stleary
1bde00ed4c Update README.md 2015-03-21 13:14:23 -05:00
stleary
dca3726bf1 Update README.md 2015-03-21 13:13:44 -05:00
stleary
01a2fad7fb Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-03-20 18:01:52 -05:00
stleary
68e01afd7e first checkin 2015-03-20 18:01:27 -05:00
stleary
441a00afc9 CDLTest still in progress 2015-03-20 15:34:47 -05:00
stleary
b5b4961a9d cdltest refactor, in progress 2015-03-20 07:34:03 -05:00
stleary
fd56452f6b Update README.md 2015-03-19 17:35:16 -05:00
stleary
8d9783d574 Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-03-19 17:31:27 -05:00
stleary
e899a2970d PropertTest.java coverage 94.8% 2015-03-19 17:30:44 -05:00
stleary
fac377fc13 Update README.md 2015-03-19 16:12:47 -05:00
stleary
ab08db4ad6 CookieTest 97.5% coverage 2015-03-19 16:09:29 -05:00
stleary
b557180bca more cookie code, in progress 2015-03-19 11:27:45 -05:00
stleary
d75ad1f0c0 Merge branch 'master' of https://github.com/stleary/JSON-Java-unit-test 2015-03-18 22:40:40 -05:00
stleary
df68a7b593 test suite and cookie test 2015-03-18 22:39:54 -05:00
stleary
3d3325aaca Update README.md 2015-03-18 21:51:43 -05:00
stleary
d613203eec Update README.md 2015-03-18 21:51:08 -05:00
stleary
4a5809910b final, for now, 94.8% coverage 2015-03-18 20:54:46 -05:00
stleary
a859e4f547 few more tests 2015-03-18 18:16:19 -05:00
stleary
5fc0c4e1df 72% coverage! 2015-03-18 12:40:20 -05:00
stleary
6c5e25dcb9 added embedded quotes and escapes 2015-03-18 10:13:13 -05:00
stleary
5b56b57074 updating cdltest 2015-03-17 21:47:53 -05:00
stleary
03192b0162 adding this file 2015-03-17 00:38:08 -05:00
stleary
7559b574dd Add LICENSE file via addalicense.com 2015-03-16 12:06:41 -05:00
stleary
03bb6d08be Create README.md 2015-03-16 12:00:24 -05:00
91 changed files with 18423 additions and 1918 deletions

43
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '18 18 * * 1'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- run: "mvn clean compile -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.javadoc.skip=true"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

74
.github/workflows/pipeline.yml vendored Normal file
View File

@@ -0,0 +1,74 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
# branches: [ master ]
pull_request:
branches: [ master ]
jobs:
# old-school build and jar method. No tests run or compiled.
build-1_6:
runs-on: ubuntu-latest
strategy:
matrix:
# build for java 1.6, however don't run any tests
java: [ 1.6 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Compile Java ${{ matrix.java }}
run: |
mkdir -p target/classes
javac -d target/classes/ src/main/java/org/json/*.java
- name: Create java ${{ matrix.java }} JAR
run: |
jar cvf target/org.json.jar -C target/classes .
- name: Upload Java ${{ matrix.java }} JAR
uses: actions/upload-artifact@v1
with:
name: Java ${{ matrix.java }} JAR
path: target/org.json.jar
build:
runs-on: ubuntu-latest
strategy:
matrix:
# build against supported Java LTS versions:
java: [ 8, 11 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Compile Java ${{ matrix.java }}
run: mvn clean compile -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }} -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.javadoc.skip=true
- name: Run Tests ${{ matrix.java }}
run: |
mvn test -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }}
- name: Build Test Report ${{ matrix.java }}
if: ${{ always() }}
run: |
mvn surefire-report:report-only -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }}
mvn site -DgenerateReports=false -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }}
- name: Upload Test Results ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: Test Results ${{ matrix.java }}
path: target/surefire-reports/
- name: Upload Test Report ${{ matrix.java }}
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: Test Report ${{ matrix.java }}
path: target/site/

13
.gitignore vendored
View File

@@ -1,3 +1,16 @@
# ignore eclipse project files
.project
.classpath
# ignore Intellij Idea project files
.idea
*.iml
/target/
/bin/
build
.settings/
/.gradle/
/gradle/
/gradlew
/gradlew.bat
.gitmodules

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at jsonjava060@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

22
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,22 @@
# Contribution Guidelines
Feel free to work on any issue with a #hacktoberfest label.
If you discover an issue you would like to work on, you can add a new issue to the list. If it meets our criteria, a hacktoberfest label will be added.
# Who is allowed to submit pull requests for this project?
Anyone can submit pull requests for code, tests, or documentation.
# How do you decide which pull requests to accept?
* Does it call out a bug that needs to be fixed? If so, it goes to the top of the list.
* Does it fix a major user inconvenience? These are given high priority as well.
* Does it align with the specs? If not, it will probably not be accepted. It turns out there are gray areas in the specs. If this is in a gray area, it will likely be given the benefit of the doubt.
* Does it break the existing behavior of the lib? If so, it will not be accepted, unless it fixes an egregious bug. This is happening less frequently now.
# For more guidance, see these links:
[README.md (includes build instructions)](https://github.com/stleary/JSON-java#readme)
[FAQ - all your questions answered](https://github.com/stleary/JSON-java/wiki/FAQ)

View File

@@ -1,169 +0,0 @@
package org.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* Convert a web browser cookie specification to a JSONObject and back.
* JSON and Cookies are both notations for name/value pairs.
* @author JSON.org
* @version 2015-12-09
*/
public class Cookie {
/**
* Produce a copy of a string in which the characters '+', '%', '=', ';'
* and control characters are replaced with "%hh". This is a gentle form
* of URL encoding, attempting to cause as little distortion to the
* string as possible. The characters '=' and ';' are meta characters in
* cookies. By convention, they are escaped using the URL-encoding. This is
* only a convention, not a standard. Often, cookies are expected to have
* encoded values. We encode '=' and ';' because we must. We encode '%' and
* '+' because they are meta characters in URL encoding.
* @param string The source string.
* @return The escaped result.
*/
public static String escape(String string) {
char c;
String s = string.trim();
int length = s.length();
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' || c == '=' || c == ';') {
sb.append('%');
sb.append(Character.forDigit((char)((c >>> 4) & 0x0f), 16));
sb.append(Character.forDigit((char)(c & 0x0f), 16));
} else {
sb.append(c);
}
}
return sb.toString();
}
/**
* Convert a cookie specification string into a JSONObject. The string
* will contain a name value pair separated by '='. The name and the value
* will be unescaped, possibly converting '+' and '%' sequences. The
* cookie properties may follow, separated by ';', also represented as
* name=value (except the secure property, which does not have a value).
* The name will be stored under the key "name", and the value will be
* stored under the key "value". This method does not do checking or
* validation of the parameters. It only converts the cookie string into
* a JSONObject.
* @param string The cookie specification string.
* @return A JSONObject containing "name", "value", and possibly other
* members.
* @throws JSONException
*/
public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.nextTo(';'));
x.next();
while (x.more()) {
name = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (name.equals("secure")) {
value = Boolean.TRUE;
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
} else {
value = unescape(x.nextTo(';'));
x.next();
}
jo.put(name, value);
}
return jo;
}
/**
* Convert a JSONObject into a cookie specification string. The JSONObject
* must contain "name" and "value" members.
* If the JSONObject contains "expires", "domain", "path", or "secure"
* members, they will be appended to the cookie specification string.
* All other members are ignored.
* @param jo A JSONObject
* @return A cookie specification string
* @throws JSONException
*/
public static String toString(JSONObject jo) throws JSONException {
StringBuilder sb = new StringBuilder();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
sb.append(jo.getString("expires"));
}
if (jo.has("domain")) {
sb.append(";domain=");
sb.append(escape(jo.getString("domain")));
}
if (jo.has("path")) {
sb.append(";path=");
sb.append(escape(jo.getString("path")));
}
if (jo.optBoolean("secure")) {
sb.append(";secure");
}
return sb.toString();
}
/**
* Convert <code>%</code><i>hh</i> sequences to single characters, and
* convert plus to space.
* @param string A string that may contain
* <code>+</code>&nbsp;<small>(plus)</small> and
* <code>%</code><i>hh</i> sequences.
* @return The unescaped string.
*/
public static String unescape(String string) {
int length = string.length();
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
int d = JSONTokener.dehexchar(string.charAt(i + 1));
int e = JSONTokener.dehexchar(string.charAt(i + 2));
if (d >= 0 && e >= 0) {
c = (char)(d * 16 + e);
i += 2;
}
}
sb.append(c);
}
return sb.toString();
}
}

433
Examples.md Normal file
View File

@@ -0,0 +1,433 @@
<h1>Examples</h1>
<p>Imports used in the examples: </p>
```
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
```
<p>This document's intention is to explain to new-comers the basics of this project</p>
<h2>Part 1: Creating a JSON document</h2>
<h3>Using JSONArray</h3>
```
private static void JSONExampleArray1() {
//We create a JSONObject from a String containing an array using JSONArray
//Firstly, we declare an Array in a String
String arrayStr =
"["+"true,"+"false,"+ "\"true\","+ "\"false\","+"\"hello\","+"23.45e-4,"+
"\"23.45\","+"42,"+"\"43\","+"["+"\"world\""+"],"+
"{"+
"\"key1\":\"value1\","+
"\"key2\":\"value2\","+
"\"key3\":\"value3\","+
"\"key4\":\"value4\""+
"},"+
"0,"+"\"-1\""+
"]";
//Then, we initializate the JSONArray thanks to its constructor
JSONArray array = new JSONArray(arrayStr);
System.out.println("Values array: "+ array);
//We convert that array into a JSONObject, but first, we need the labels, so we need another JSONArray with the labels.
//Here we will use an auxiliary function to get one for the example.
JSONArray list = listNumberArray(array.length());
System.out.println("Label Array: "+ list.toString());
//Now, we construct the JSONObject using both the value array and the label array.
JSONObject object = array.toJSONObject(list);
System.out.println("Final JSONOBject: " + object);
}
//This method creates an JSONArray of labels in which those are generated by their positions
private static JSONArray listNumberArray(int max){
JSONArray res = new JSONArray();
for (int i=0; i<max;i++) {
//The value of the labels must be an String in order to make it work
res.put(String.valueOf(i));
}
return res;
}
```
```
private static void JSONExampleArray2() {
//We can also create an Array without a String by creating an empty array and adding elements to it
JSONArray array = new JSONArray();
//Adding elements with .put()
array.put("value");
array.put(5);
array.put(-23.45e67);
array.put(true);
//We convert it to JSONObject providing a label arrray like last time
JSONArray list = listNumberArray(array.length());
JSONObject object = array.toJSONObject(list);
System.out.println("Final JSONOBject: " + object);
}
```
<h3>Using JSONStringer</h3>
```
private static void JSONExampleStringer() {
//We initializate the JSONStringer
JSONStringer jsonStringer = new JSONStringer();
//Now we start the process of adding elements with .object()
jsonStringer.object();
//We can now add elements as keys and values with .values () and .key()
jsonStringer.key("trueValue").value(true);
jsonStringer.key("falseValue").value(false);
jsonStringer.key("nullValue").value(null);
jsonStringer.key("stringValue").value("hello world!");
jsonStringer.key("complexStringValue").value("h\be\tllo w\u1234orld!");
jsonStringer.key("intValue").value(42);
jsonStringer.key("doubleValue").value(-23.45e67);
//We end this prcedure with .ednObject
jsonStringer.endObject();
//Once we have a JSONStringer, we convert it to JSONObject generating a String and using JSONObject's contructor.
String str = jsonStringer.toString();
JSONObject jsonObject = new JSONObject(str);
System.out.println("Final JSONOBject: " + jsonObject);
}
```
<h3>Using JSONObject</h3>
```
private static void JSONExampleObject1() {
//We can create a JSONObject from a String with the class builder
String string = "{\"0\":\"value\",\"1\":5,\"2\":-2.345E68,\"3\":true}";
JSONObject example = new JSONObject(string);
System.out.println("Final JSONObject: " + example);
}
```
```
private static void JSONExampleObject2() {
//We can also create a JSONObject directly without messing around with any of the other functions.
JSONObject example = new JSONObject();
//Now we add the keys and values in a similar way as the Stringer method
example.put("key", "value");
//As you can see, the first entry is the key and the second would be its associeted value.
example.put("key2", 5);
example.put("key3", -23.45e67);
example.put("trueValue", true);
//We can't add null values thougth
//example.put("nullValue", null); //This is not possible
System.out.println("Final JSONOBject: " + example);
}
```
```
private static void JSONExampleObject3() {
//We can also create a JSONObject with a Java Map
//YoU will need a Map whose keys are Strings. The values can be whatever you want
Map<String,Double> map = new HashMap<String, Double>();
map.put("key1", 1.0);
map.put("key2", -23.45e67);
//We create the JSONObject with the map with its class builder
JSONObject example = new JSONObject(map);
System.out.println("Final JSONOBject: " + example);
}
```
<h3>Using JSONWriter</h3>
```
private static void JSONExamplWriter() {
//This method works in a very similar way to Object and Stringer in the construction of the JSON.
//The difference is that it needs a Java object called "Appendable" like StringBuilder
StringBuilder write = new StringBuilder();
JSONWriter jsonWriter = new JSONWriter(write);
//We behave now the same way as Stringer
jsonWriter.object();
jsonWriter.key("trueValue").value(true);
jsonWriter.key("falseValue").value(false);
jsonWriter.key("nullValue").value(null);
jsonWriter.key("stringValue").value("hello world!");
jsonWriter.key("complexStringValue").value("h\be\tllo w\u1234orld!");
jsonWriter.key("intValue").value(42);
jsonWriter.key("doubleValue").value(-23.45e67);
jsonWriter.endObject();
//The resoult should be in the "write" object
System.out.println("JSON: " + write.toString());
//The difference is that we don't get a JSONObject in this one.
}
```
```
private static void JSONExampleTokener() {
//A partir de una String podemos crear un JSONTokener, que lo podemos usar alternativamente para JSONArray,JSONObject
String string = "this is not a valid JSON string";
JSONTokener token = new JSONTokener(string);
//Now you can use the token in JSONObject and Array the same way as a String
JSONObject object = new JSONObject(token);
JSONArray array = new JSONArray(token);
}
```
<h2>Part 2: Conversion methods</h2>
<p>We don't need to have a JSON document to work. This project also admits conversions from other type of files.</p>
<p>Secondly, we can also convert from JSON to those type of files.</p>
<h3>Extra: Conversion to JSONArray</h3>
```
private static void JSONObjectToArray() {
//We start with a JSONObject
String string = "{\"0\":\"value\",\"1\":5,\"2\":-2.345E68,\"3\":true}";
JSONObject example = new JSONObject(string);
//We need a list of key strings like the reverse operation
JSONArray keyStrings = listNumberArray(example.length());
//Then we convert to the Array using both elelements
JSONArray array = example.toJSONArray(keyStrings);
System.out.println("Final JSONArray: " + array);
}
```
<h3>XML Conversions</h3>
```
private static void XMLToExampleConversion() {
//We start with a JSONObject
String string = "{\"0\":\"value\",\"1\":5,\"2\":-2.345E68,\"3\":true}";
JSONObject example = new JSONObject(string);
//We obtain a String with XML format with toString()
String output = XML.toString(example);
System.out.println("Final XML: " + output);
}
```
```
private static void XMLFromExampleConversion() {
//We start with a string with the XML format
String string = "<0>value</0><1>5</1><2>-2.345E+68</2><3>true</3>";
//We obtain a JSONObject with toJSONOBject()
JSONObject output = XML.toJSONObject(string);
System.out.println("Final JSONObject: " + output);
}
```
<h3>Cookie Conversions</h3>
```
private static void CookieToExampleConversion() {
//We start with a JSONObject
//The JSONOBject needs to entries that gives the cookie a name and gives the field "name" a name too.
//The Cokkie format doesn't support booleans
String string = "{\"name\":\"Cookie-Name\",\"value\":\"name\",\"1\":5,\"2\":-2.345E68,\"3\":'true'}";
JSONObject example = new JSONObject(string);
//We obtain a String with Cookie format with toString()
String output = Cookie.toString(example);
System.out.println("Final Cookie: " + output);
}
```
```
private static void CookieFromExampleConversion() {
//We start with a string with the Cookie format
String string = "Cookie-Name=name;1=5;2=-2.345E%2b68;3=true";
//We obtain a JSONObject with toJSONOBject()
JSONObject output = Cookie.toJSONObject(string);
System.out.println("Final JSONObject: " + output);
}
```
<h3>HTTP Conversions</h3>
```
private static void HTTPToExampleConversion() {
//We start with a JSONObject
//The JSONObject must have the minimun header for a HTTP request or header
String string = "{\"Method\":\"POST\",\"Request-URI\":'/',\"HTTP-Version\":'HTTP/1.1',\"Value1\":true,\"Value2\":2,\"Value3\":-2.345E68}";
JSONObject example = new JSONObject(string);
//We obtain a String with HTTP format with toString()
String output = HTTP.toString(example);
System.out.println("Final HTTP: " + output);
}
```
```
private static void HTTPFromExampleConversion() {
//We start with a string with the HTTP format
String string = "Final HTTP: POST '/' HTTP/1.1 Value3: -2.345E+68 Value1: true Value2: 2";
//We obtain a JSONObject with toJSONOBject()
JSONObject output = HTTP.toJSONObject(string);
System.out.println("Final JSONObject: " + output);
}
```
<h3>CDL Conversions</h3>
```
private static void CDLToExampleConversion() {
//We start with some JSONObjects with the same values in the keys but different values in the "values"
String string = "{\"0\":\"value\",\"1\":5,\"2\":-2.345E68,\"3\":true}";
JSONObject example = new JSONObject(string);
String string2 = "{\"0\":\"value2\",\"1\":6,\"2\":-8.345E68,\"3\":false}";
JSONObject example2 = new JSONObject(string2);
//We need now a JSONArray with those JSONObjects
JSONArray array = new JSONArray();
array.put(example);
array.put(example2);
//We obtain a String with XML format with toString()
String output = CDL.toString(array);
System.out.println("Final CDL: \r\n" + output);
}
```
```
private static void CDLFromExampleConversion() {
//We start wtih a String with the CDL format
String string = "0,1,2,3\n"
+ "value,5,-2.345E+68,true\n"
+ "value2,6,-8.345E+68,false";
//We obtain a JSONArray with toJSONOBject()
JSONArray output = CDL.toJSONArray(string);
System.out.println("Final JSONArray: " + output);
}
```
<h3>Properties Conversions</h3>
```
private static Properties PropertyToExampleConversion() {
//We start with a JSONObject
String string = "{\"0\":\"value\",\"1\":5,\"2\":-2.345E68,\"3\":true}";
JSONObject example = new JSONObject(string);
//We obtain a String with Properties format with toString()
Properties output = Property.toProperties(example);
System.out.println("Final Properties: " + output);
return output;
}
```
```
private static void PropertyFromExampleConversion() {
//We start with a Properties object
Properties input = PropertyToExampleConversion();
//We obtain a JSONObject with toJSONOBject()
JSONObject output = Property.toJSONObject(input);
System.out.println("Final JSONObject: " + output);
}
```
<h2>List of all examples methods</h2>
```
public static void main(String[] args) {
//JSONObjectToArray();
//JSONExampleArray1();
//JSONExampleArray2();
//JSONExampleStringer();
//JSONExampleObject1();
//JSONExampleObject2();
//JSONExampleObject3();
//JSONExamplWriter();
//XMLToExampleConversion();
//XMLFromExampleConversion();
//CookieToExampleConversion();
//CookieFromExampleConversion();
//HTTPToExampleConversion();
//HTTPFromExampleConversion();
//CDLToExampleConversion();
//CDLFromExampleConversion();
//PropertyToExampleConversion();
//PropertyFromExampleConversion();
}
```

View File

@@ -1,45 +0,0 @@
package org.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* The JSONPointerException is thrown by {@link JSONPointer} if an error occurs
* during evaluating a pointer.
*
* @author JSON.org
* @version 2016-05-13
*/
public class JSONPointerException extends JSONException {
private static final long serialVersionUID = 8872944667561856751L;
public JSONPointerException(String message) {
super(message);
}
public JSONPointerException(String message, Throwable cause) {
super(message, cause);
}
}

23
LICENSE
View File

@@ -1,23 +1,2 @@
============================================================================
Public Domain.
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

179
README.md
View File

@@ -1,122 +1,107 @@
![Json-Java logo](https://github.com/stleary/JSON-java/blob/master/images/JsonJava.png?raw=true)
<sub><sup>image credit: Ismael Pérez Ortiz</sup></sub>
JSON in Java [package org.json]
===============================
[![Maven Central](https://img.shields.io/maven-central/v/org.json/json.svg)](https://mvnrepository.com/artifact/org.json/json)
JSON is a light-weight, language independent, data interchange format.
See http://www.JSON.org/
The files in this package implement JSON encoders/decoders in Java.
It also includes the capability to convert between JSON and XML, HTTP
headers, Cookies, and CDL.
This is a reference implementation. There is a large number of JSON packages
in Java. Perhaps someday the Java community will standardize on one. Until
then, choose carefully.
The license includes this restriction: "The software shall be used for good,
not evil." If your conscience cannot live with that, then choose a different
package.
The package compiles on Java 1.6-1.8.
**[Click here if you just want the latest release jar file.](https://search.maven.org/remotecontent?filepath=org/json/json/20220924/json-20220924.jar)**
**JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener`
to produce a map-like object. The object provides methods for manipulating its
contents, and for producing a JSON compliant object serialization.
# Overview
**JSONArray.java**: The `JSONArray` can parse text from a String or a `JSONTokener`
to produce a vector-like object. The object provides methods for manipulating
its contents, and for producing a JSON compliant array serialization.
[JSON](http://www.JSON.org/) is a light-weight language-independent data interchange format.
**JSONTokener.java**: The `JSONTokener` breaks a text into a sequence of individual
tokens. It can be constructed from a `String`, `Reader`, or `InputStream`.
The JSON-Java package is a reference implementation that demonstrates how to parse JSON documents into Java objects and how to generate new JSON documents from the Java classes.
**JSONException.java**: The `JSONException` is the standard exception type thrown
by this package.
Project goals include:
* Reliable and consistent results
* Adherence to the JSON specification
* Easy to build, use, and include in other projects
* No external dependencies
* Fast execution and low memory footprint
* Maintain backward compatibility
* Designed and tested to use on Java versions 1.6 - 1.11
**JSONPointer.java**: Implementation of
[JSON Pointer (RFC 6901)](https://tools.ietf.org/html/rfc6901). Supports
JSON Pointers both in the form of string representation and URI fragment
representation.
The files in this package implement JSON encoders and decoders. The package can also convert between JSON and XML, HTTP headers, Cookies, and CDL.
**JSONString.java**: The `JSONString` interface requires a `toJSONString` method,
allowing an object to provide its own serialization.
# If you would like to contribute to this project
**JSONStringer.java**: The `JSONStringer` provides a convenient facility for
building JSON strings.
For more information on contributions, please see [CONTRIBUTING.md](https://github.com/stleary/JSON-java/blob/master/docs/CONTRIBUTING.md)
**JSONWriter.java**: The `JSONWriter` provides a convenient facility for building
JSON text through a writer.
Bug fixes, code improvements, and unit test coverage changes are welcome! Because this project is currently in the maintenance phase, the kinds of changes that can be accepted are limited. For more information, please read the [FAQ](https://github.com/stleary/JSON-java/wiki/FAQ).
# Build Instructions
The org.json package can be built from the command line, Maven, and Gradle. The unit tests can be executed from Maven, Gradle, or individually in an IDE e.g. Eclipse.
**Building from the command line**
*Build the class files from the package root directory src/main/java*
````
javac org/json/*.java
````
*Create the jar file in the current directory*
````
jar cf json-java.jar org/json/*.class
````
*Compile a program that uses the jar (see example code below)*
````
javac -cp .;json-java.jar Test.java (Windows)
javac -cp .:json-java.jar Test.java (Unix Systems)
````
*Test file contents*
````
import org.json.JSONObject;
public class Test {
public static void main(String args[]){
JSONObject jo = new JSONObject("{ \"abc\" : \"def\" }");
System.out.println(jo.toString());
}
}
````
*Execute the Test file*
````
java -cp .;json-java.jar Test (Windows)
java -cp .:json-java.jar Test (Unix Systems)
````
*Expected output*
````
{"abc":"def"}
````
**CDL.java**: `CDL` provides support for converting between JSON and comma
delimited lists.
**Tools to build the package and execute the unit tests**
**Cookie.java**: `Cookie` provides support for converting between JSON and cookies.
Execute the test suite with Maven:
```
mvn clean test
```
**CookieList.java**: `CookieList` provides support for converting between JSON and
cookie lists.
Execute the test suite with Gradlew:
**HTTP.java**: `HTTP` provides support for converting between JSON and HTTP headers.
```
gradlew clean build test
```
**HTTPTokener.java**: `HTTPTokener` extends `JSONTokener` for parsing HTTP headers.
# Notes
**XML.java**: `XML` provides support for converting between JSON and XML.
For more information, please see [NOTES.md](https://github.com/stleary/JSON-java/blob/master/docs/NOTES.md)
**JSONML.java**: `JSONML` provides support for converting between JSONML and XML.
# Files
**XMLTokener.java**: `XMLTokener` extends `JSONTokener` for parsing XML text.
For more information on files, please see [FILES.md](https://github.com/stleary/JSON-java/blob/master/docs/FILES.md)
Unit tests are maintained in a separate project. Contributing developers can test
JSON-java pull requests with the code in this project:
https://github.com/stleary/JSON-Java-unit-test
# Release history:
Numeric types in this package comply with
[ECMA-404: The JSON Data Interchange Format](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and
[RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc7159#section-6).
This package fully supports `Integer`, `Long`, and `Double` Java types. Partial support
for `BigInteger` and `BigDecimal` values in `JSONObject` and `JSONArray` objects is provided
in the form of `get()`, `opt()`, and `put()` API methods.
Although 1.6 compatibility is currently supported, it is not a project goal and may be
removed in some future release.
In compliance with RFC7159 page 10 section 9, the parser is more lax with what is valid
JSON than the Generator. For Example, the tab character (U+0009) is allowed when reading
JSON Text strings, but when output by the Generator, tab is properly converted to \t in
the string. Other instances may occur where reading invalid JSON text does not cause an
error to be generated. Malformed JSON Texts such as missing end " (quote) on strings or
invalid number formats (1.2e6.3) will cause errors as such documents can not be read
reliably.
Release history:
~~~
20180130 Recent commits
20171018 Checkpoint for recent commits.
20170516 Roll up recent commits.
20160810 Revert code that was breaking opt*() methods.
20160807 This release contains a bug in the JSONObject.opt*() and JSONArray.opt*() methods,
it is not recommended for use.
Java 1.6 compatability fixed, JSONArray.toList() and JSONObject.toMap(),
RFC4180 compatibility, JSONPointer, some exception fixes, optional XML type conversion.
Contains the latest code as of 7 Aug, 2016
20160212 Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb, 2016.
20151123 JSONObject and JSONArray initialization with generics. Contains the
latest code as of 23 Nov, 2015.
20150729 Checkpoint for Maven central repository release. Contains the latest code
as of 29 July, 2015.
~~~
JSON-java releases can be found by searching the Maven repository for groupId "org.json"
and artifactId "json". For example:
https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.json%22%20AND%20a%3A%22json%22
For the release history, please see [RELEASES.md](https://github.com/stleary/JSON-java/blob/master/docs/RELEASES.md)

5
SECURITY.md Normal file
View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please follow the instructions in the ["How are vulnerabilities and exploits handled?"](https://github.com/stleary/JSON-java/wiki/FAQ#how-are-vulnerabilities-and-exploits-handled) section in the FAQ.

55
build.gradle Normal file
View File

@@ -0,0 +1,55 @@
/*
* This file was generated by the Gradle 'init' task.
*/
apply plugin: 'java'
apply plugin: 'eclipse'
// apply plugin: 'jacoco'
apply plugin: 'maven-publish'
//plugins {
// id 'java'
//id 'maven-publish'
// }
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri('https://oss.sonatype.org/content/repositories/snapshots')
}
}
dependencies {
testImplementation 'junit:junit:4.13.1'
testImplementation 'com.jayway.jsonpath:json-path:2.1.0'
testImplementation 'org.mockito:mockito-core:1.9.5'
}
subprojects {
tasks.withType(Javadoc).all { enabled = false }
}
group = 'org.json'
version = 'v20211205-SNAPSHOT'
description = 'JSON in Java'
sourceCompatibility = '1.7'
configurations.all {
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

22
docs/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,22 @@
# Contribution Guidelines
Feel free to work on any issue with a #hacktoberfest label.
If you discover an issue you would like to work on, you can add a new issue to the list. If it meets our criteria, a hacktoberfest label will be added.
# Who is allowed to submit pull requests for this project?
Anyone can submit pull requests for code, tests, or documentation.
# How do you decide which pull requests to accept?
* Does it call out a bug that needs to be fixed? If so, it goes to the top of the list.
* Does it fix a major user inconvenience? These are given high priority as well.
* Does it align with the specs? If not, it will probably not be accepted. It turns out there are gray areas in the specs. If this is in a gray area, it will likely be given the benefit of the doubt.
* Does it break the existing behavior of the lib? If so, it will not be accepted, unless it fixes an egregious bug. This is happening less frequently now.
# For more guidance, see these links:
[README.md (includes build instructions)](https://github.com/stleary/JSON-java#readme)
[FAQ - all your questions answered](https://github.com/stleary/JSON-java/wiki/FAQ)

62
docs/FILES.md Normal file
View File

@@ -0,0 +1,62 @@
# Files
**JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener`
to produce a map-like object. The object provides methods for manipulating its
contents, and for producing a JSON compliant object serialization.
**JSONArray.java**: The `JSONArray` can parse text from a String or a `JSONTokener`
to produce a vector-like object. The object provides methods for manipulating
its contents, and for producing a JSON compliant array serialization.
**JSONTokener.java**: The `JSONTokener` breaks a text into a sequence of individual
tokens. It can be constructed from a `String`, `Reader`, or `InputStream`. It also can
parse text from a `String`, `Number`, `Boolean` or `null` like `"hello"`, `42`, `true`,
`null` to produce a simple json object.
**JSONException.java**: The `JSONException` is the standard exception type thrown
by this package.
**JSONPointer.java**: Implementation of
[JSON Pointer (RFC 6901)](https://tools.ietf.org/html/rfc6901). Supports
JSON Pointers both in the form of string representation and URI fragment
representation.
**JSONPropertyIgnore.java**: Annotation class that can be used on Java Bean getter methods.
When used on a bean method that would normally be serialized into a `JSONObject`, it
overrides the getter-to-key-name logic and forces the property to be excluded from the
resulting `JSONObject`.
**JSONPropertyName.java**: Annotation class that can be used on Java Bean getter methods.
When used on a bean method that would normally be serialized into a `JSONObject`, it
overrides the getter-to-key-name logic and uses the value of the annotation. The Bean
processor will look through the class hierarchy. This means you can use the annotation on
a base class or interface and the value of the annotation will be used even if the getter
is overridden in a child class.
**JSONString.java**: The `JSONString` interface requires a `toJSONString` method,
allowing an object to provide its own serialization.
**JSONStringer.java**: The `JSONStringer` provides a convenient facility for
building JSON strings.
**JSONWriter.java**: The `JSONWriter` provides a convenient facility for building
JSON text through a writer.
**CDL.java**: `CDL` provides support for converting between JSON and comma
delimited lists.
**Cookie.java**: `Cookie` provides support for converting between JSON and cookies.
**CookieList.java**: `CookieList` provides support for converting between JSON and
cookie lists.
**HTTP.java**: `HTTP` provides support for converting between JSON and HTTP headers.
**HTTPTokener.java**: `HTTPTokener` extends `JSONTokener` for parsing HTTP headers.
**XML.java**: `XML` provides support for converting between JSON and XML.
**JSONML.java**: `JSONML` provides support for converting between JSONML and XML.
**XMLTokener.java**: `XMLTokener` extends `JSONTokener` for parsing XML text.

87
docs/NOTES.md Normal file
View File

@@ -0,0 +1,87 @@
# Notes
**Recent directory structure change**
_Due to a recent commit - [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515) - the structure of the project has changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several tools used to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it._
**Implementation notes**
Numeric types in this package comply with
[ECMA-404: The JSON Data Interchange Format](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf) and
[RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259#section-6).
This package fully supports `Integer`, `Long`, and `Double` Java types. Partial support
for `BigInteger` and `BigDecimal` values in `JSONObject` and `JSONArray` objects is provided
in the form of `get()`, `opt()`, and `put()` API methods.
Although 1.6 compatibility is currently supported, it is not a project goal and might be
removed in some future release.
In compliance with RFC8259 page 10 section 9, the parser is more lax with what is valid
JSON then the Generator. For Example, the tab character (U+0009) is allowed when reading
JSON Text strings, but when output by the Generator, the tab is properly converted to \t in
the string. Other instances may occur where reading invalid JSON text does not cause an
error to be generated. Malformed JSON Texts such as missing end " (quote) on strings or
invalid number formats (1.2e6.3) will cause errors as such documents can not be read
reliably.
Some notable exceptions that the JSON Parser in this library accepts are:
* Unquoted keys `{ key: "value" }`
* Unquoted values `{ "key": value }`
* Unescaped literals like "tab" in string values `{ "key": "value with an unescaped tab" }`
* Numbers out of range for `Double` or `Long` are parsed as strings
Recent pull requests added a new method `putAll` on the JSONArray. The `putAll` method
works similarly to other `put` methods in that it does not call `JSONObject.wrap` for items
added. This can lead to inconsistent object representation in JSONArray structures.
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) };
// these will be wrapped
JSONArray jArr = new JSONArray(myArr);
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
```
For structure 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();
// these will not be wrapped
jArr.putAll(myArr);
// 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) };
// these will be wrapped
JSONArray jArr = new JSONArray(myArr);
// these will be wrapped
jArr.putAll(new JSONArray(new SomeBean[]{ new SomeBean(3), new SomeBean(4) }));
// our jArr is now consistent.
```
**Unit Test Conventions**
Test filenames should consist of the name of the module being tested, with the suffix "Test".
For example, <b>Cookie.java</b> is tested by <b>CookieTest.java</b>.
<b>The fundamental issues with JSON-Java testing are:</b><br>
* <b>JSONObjects</b> are unordered, making simple string comparison ineffective.
* Comparisons via **equals()** is not currently supported. Neither <b>JSONArray</b> nor <b>JSONObject</b> override <b>hashCode()</b> or <b>equals()</b>, so comparison defaults to the <b>Object</b> equals(), which is not useful.
* Access to the <b>JSONArray</b> and <b>JSONObject</b> internal containers for comparison is not currently available.
<b>General issues with unit testing are:</b><br>
* Just writing tests to make coverage goals tends to result in poor tests.
* Unit tests are a form of documentation - how a given method works is demonstrated by the test. So for a code reviewer or future developer looking at code a good test helps explain how a function is supposed to work according to the original author. This can be difficult if you are not the original developer.
* It is difficult to evaluate unit tests in a vacuum. You also need to see the code being tested to understand if a test is good.
* Without unit tests, it is hard to feel confident about the quality of the code, especially when fixing bugs or refactoring. Good tests prevent regressions and keep the intent of the code correct.
* If you have unit test results along with pull requests, the reviewer has an easier time understanding your code and determining if it works as intended.

44
docs/RELEASES.md Normal file
View File

@@ -0,0 +1,44 @@
# Release history:
JSON-java releases can be found by searching the Maven repository for groupId "org.json"
and artifactId "json". For example:
[https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav](https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav)
~~~
20220924 New License - public domain, and some minor updates
20220320 Wrap StackOverflow with JSONException
20211205 Recent commits and some bug fixes for similar()
20210307 Recent commits and potentially breaking fix to JSONPointer
20201115 Recent commits and first release after project structure change
20200518 Recent commits and snapshot before project structure change
20190722 Recent commits
20180813 POM change to include Automatic-Module-Name (#431)
20180130 Recent commits
20171018 Checkpoint for recent commits.
20170516 Roll up recent commits.
20160810 Revert code that was breaking opt*() methods.
20160807 This release contains a bug in the JSONObject.opt*() and JSONArray.opt*() methods,
it is not recommended for use.
Java 1.6 compatability fixed, JSONArray.toList() and JSONObject.toMap(),
RFC4180 compatibility, JSONPointer, some exception fixes, optional XML type conversion.
Contains the latest code as of 7 Aug 2016
20160212 Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb 2016.
20151123 JSONObject and JSONArray initialization with generics. Contains the latest code as of 23 Nov 2015.
20150729 Checkpoint for Maven central repository release. Contains the latest code
as of 29 July 2015.
~~~

5
docs/SECURITY.md Normal file
View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please follow the instructions in the ["How are vulnerabilities and exploits handled?"](https://github.com/stleary/JSON-java/wiki/FAQ#how-are-vulnerabilities-and-exploits-handled) section in the FAQ.

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

183
gradlew vendored Normal file
View File

@@ -0,0 +1,183 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

103
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,103 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
images/JsonJava.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

170
pom.xml Normal file
View File

@@ -0,0 +1,170 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220924</version>
<packaging>bundle</packaging>
<name>JSON in Java</name>
<description>
JSON is a light-weight, language independent, data interchange format.
See http://www.JSON.org/
The files in this package implement JSON encoders/decoders in Java.
It also includes the capability to convert between JSON and XML, HTTP
headers, Cookies, and CDL.
This is a reference implementation. There is a large number of JSON packages
in Java. Perhaps someday the Java community will standardize on one. Until
then, choose carefully.
</description>
<url>https://github.com/douglascrockford/JSON-java</url>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>
<scm>
<url>https://github.com/douglascrockford/JSON-java.git</url>
<connection>scm:git:git://github.com/douglascrockford/JSON-java.git</connection>
<developerConnection>scm:git:git@github.com:douglascrockford/JSON-java.git</developerConnection>
</scm>
<licenses>
<license>
<name>Public Domain</name>
<url>https://github.com/stleary/JSON-java/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Douglas Crockford</name>
<email>douglas@crockford.com</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
org.json
</Export-Package>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.json</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,27 +1,7 @@
package org.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Public Domain.
*/
/**
@@ -55,7 +35,7 @@ public class CDL {
private static String getValue(JSONTokener x) throws JSONException {
char c;
char q;
StringBuffer sb;
StringBuilder sb;
do {
c = x.next();
} while (c == ' ' || c == '\t');
@@ -65,7 +45,7 @@ public class CDL {
case '"':
case '\'':
q = c;
sb = new StringBuffer();
sb = new StringBuilder();
for (;;) {
c = x.next();
if (c == q) {
@@ -98,7 +78,7 @@ public class CDL {
* Produce a JSONArray of strings from a row of comma delimited values.
* @param x A JSONTokener of the source text.
* @return A JSONArray of strings.
* @throws JSONException
* @throws JSONException if a called function fails
*/
public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {