56 Commits
Author SHA1 Message Date
John J. Aylward 93ffca36c3 fixes spacing 2016-09-28 20:23:30 -04:00
John J. Aylward e477d7002b fixes object comparison 2016-09-28 20:22:12 -04:00
John J. Aylward fb1db9341e Changes encoding to better match the XML spec section 2.2 2016-09-28 20:15:58 -04:00
John J. Aylward adb0478f66 properly unescape tokens in JSONML for reversability. 2016-09-22 16:23:09 -04:00
John J. Aylward f6a00e94c7 adds test for unicode that has surrogate pairs 2016-09-22 16:12:00 -04:00
John J. Aylward f58a0f4684 fixes code point appends to string builder 2016-09-22 16:10:49 -04:00
John J. Aylward c11e09959c Fixes code point output when unescaping code points. XML escapes are an entire code point, not surrogate pairs like in JSON. 2016-09-22 15:40:26 -04:00
John J. Aylward 68f92eb395 Adds more javadoc. 2016-09-22 14:40:39 -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 34652a8706 Updates to iterate on code points instead of characters and changes the encoding to only encode control characters as defined by ISO standard. 2016-09-22 14:13:14 -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
John J. Aylward a2d3b59394 Implements unicode escaping similar to JSONObject.
* Removes deprecation on XML.stringToValue(). It now provides unescaping for strings to convert XML entities back into values.
* New unescape function to handle XML entities -> value conversion.
2016-09-22 12:38:06 -04:00
John J. Aylward 88f65c5bea Merge branch 'master' of github.com:stleary/JSON-java into NumberOutputFix
# Conflicts:
#	JSONObject.java
2016-08-26 11:32:35 -04:00
John J. Aylward 2f2cd4dfc5 Fix for number output bug.
java.lang.Number is currently output without any validation. For all java.* Numbers, this is fine, but for custom Number implementations like Complex or Fraction, the resulting JSON output may be invalid.

For example: If a Fraction implementation defines its' toString method as `return numerator + "/" + denominator`, then the resulting JSON output would be something like this:

```json
{ "fraction" : 1/2 }
```

This is not valid JSON.

This commit verifies that the string representation of the number is close to a JSON formatted number by use of the BigDecimal constructor. If the constructor throws a NumberFormatException, then the string value is instead quoted as a string. The example above would instead output like the following:

```json
{ "fraction" : "1/2" }
```
2016-08-17 12:54:30 -04: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
John J. Aylward bbd3fd5571 Adds tests for numbers 2016-08-16 20:52:41 -04:00
John J. Aylward 349a209df3 Merge remote-tracking branch 'upstream/master' into EnumCleanup 2016-08-15 10:25:27 -04:00
John J. Aylward 7851e9b2e8 revert back changes to Number support 2016-08-15 10:24:38 -04:00
John J. Aylward 91107e3e82 Adds support to JSONObject wrap and write methods to explicitly handle Enums.
The new way enums are handled is to always place the actual enum in the
JSONObject/JSONArray. When writing, we always write the actual "name"
of the enum, so even with a toString override on the enum class, the
value remains consistant and compatible with the optEnum/getEnum methods.

The constructor JSONObject(Object) functions the same way as before when
passing an enum and is consistent with other "value" types. For example,
when creating a JSONObject with Long, Boolean, BigDecimal as the constructor
parameter, the value will be treated as a "bean".
2016-08-11 12:22:31 -04:00
John J. Aylward 5779400f26 test updates to make sure Enums are handled consistently. 2016-08-11 12:21:49 -04: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
John J. Aylward 215321cd28 updates Test cases to support new JSONML and XML conversion options 2016-07-18 15:04:03 -04:00
John J. Aylward 09d37e59b8 Cleans up the JSONML changes and adds similar changes to the XML class 2016-07-18 14:42:21 -04:00
John J. Aylward 93704371bb Updates to the Javadoc for exceptions 2016-07-18 14:12:06 -04:00
John J. Aylward c2de224711 Verify opt method conversions for JSONArray and JSONObject 2016-07-08 16:58:58 -04: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 42791ab12d Updates README to note that the parser does allow some invalid JSON 2016-06-16 13:01:22 -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
John J. Aylward c2b3f2bdb1 adds back in the XML.stringToValue method, but deprecates it. 2016-01-27 15:21:11 -05:00
John J. Aylward 3007fc8ebe Removes custom XML stringToValue method in favor of keeping a consistent
implementation in JSONObject
2016-01-27 15:03:19 -05: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
John J. Aylward 39b1c0cb66 fixes error in -0 check 2016-01-27 10:45:23 -05:00
John J. Aylward 07b2d65e30 Fixes #187 -0 now returns as a double. 2016-01-27 10:39:31 -05:00
John J. Aylward 5b67330b71 Merge branch 'master' of https://github.com/douglascrockford/JSON-java 2016-01-27 09:53:03 -05:00
John J. Aylward 48302592cf Merge branch 'master' of https://github.com/douglascrockford/JSON-java 2015-12-09 10:07:36 -05:00
John J. Aylward ec8f649467 Merge branch 'master' of https://github.com/douglascrockford/JSON-java 2015-12-08 09:27:54 -05:00
John J. Aylward 3850b5fd25 Add tests to verify arrays are handled consistently. 2015-10-26 18:35:53 -04:00
John J. Aylward 105426b53f Formatting 2015-10-26 18:35:40 -04:00
John J. Aylward 7886c96204 Changes JSONArray for loops to use the new iterators. 2015-10-26 18:30:41 -04:00
John J. Aylward 91c6f09be8 Modifies XML output to be handled the same for a native java array as well as a JSONArray. 2015-10-26 18:17:37 -04: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 1b06a802cf makes params final 2015-10-12 14:54:30 -04:00
John J. Aylward 0e13241528 Expands javadoc 2015-10-12 14:53:03 -04:00
John J. Aylward e239e1967a Allows a custom message to be passed with a cause. 2015-10-12 14:52:17 -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
John J. Aylward ceba8e8c3d Fixes possible NPE 2015-10-12 14:25:18 -04:00
John J. Aylward 4e77383472 Properly overrides the Exception class. 2015-10-12 14:23:05 -04:00