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
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
c24be0e4ea
Merge pull request #274 from johnjaylward/NumberOutputFix
...
Fix for number output bug.
2016-09-09 11:42:35 -05: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
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
ebe69df8e4
Merge pull request #271 from johnjaylward/EnumCleanup
...
Update enum support to be more fully featured.
2016-08-19 10:28:04 -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
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
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
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
Sean Leary
7232a95c0b
Update JSONObject.java
...
Fixed some typos committed in #249 , since reverted, tracking issue is #263
2016-08-15 01:58:54 -05:00
Sean Leary
f96f505188
Update JSONArray.java
...
Fixed a Javadoc typo, originally fixed in #249 , since reverted. This is to address issue #263
2016-08-15 01:53:08 -05: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
Sean Leary
c400de3cfe
Merge pull request #53 from run2000/master
...
valueToString() and write() tests
2016-08-10 21:55:33 -05:00
Sean Leary
4e8e24d49d
Merge pull request #259 from run2000/appendable_v2
...
JSONWriter uses Appendable (v2)
2016-08-10 21:55:10 -05:00
Sean Leary
f881b61c81
Update XML.java
...
Removed a problematic JavaDoc in the header comment to a deprecated method
2016-08-10 15:35:26 -05:00
Sean Leary
37582a44ad
Update README
2016-08-10 09:13:22 -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
Sean Leary
154cfda9aa
Merge pull request #261 from stleary/revert-249-master
...
Revert "reduces the use of unnecessary exceptions"
2016-08-10 09:03:57 -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
45a7decba4
Revert "reduces the use of unnecessary exceptions"
2016-08-09 14:22:06 -05:00
Nicholas Cull
0c157cae75
JSONWriter uses Appendable.
2016-08-08 19:40:10 +10:00
Sean Leary
8e079599c4
Update README
2016-08-07 15:19:44 -05: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
Sean Leary
3080b8beeb
Merge pull request #253 from johnjaylward/OptionalTypeConversion
...
Optional type conversion for XML reading
2016-07-31 21:09:07 -05:00
Sean Leary
2c228ecf1a
Merge pull request #249 from Simulant87/master
...
reduces the use of unnecessary exceptions
2016-07-26 23:04:49 -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