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
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
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
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
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
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
Nils Faupel
3890bfae52
reduce the use of unnecessary exceptions
2016-07-19 19:59:30 +02:00
Nils Faupel
abf2963bbe
Revert "reduces the use of unnecessary exceptions"
...
This reverts commit 7627d40d10
.
2016-07-19 19:00:42 +02: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
Jakob Stemberger
42e0944708
Brings in changes from PR #70 to be updated to HEAD
2016-07-18 13:45:31 -04:00
Simulant
7627d40d10
reduces the use of unnecessary exceptions
2016-07-08 22:17:05 +02:00
Sean Leary
04181fb6e2
Merge pull request #246 from johnjaylward/LicenseFile
...
Add License file
2016-07-02 13:20:54 -05:00
Sean Leary
239e0b7070
Merge pull request #242 from johnjaylward/issue240
...
Fixes Issue #240
2016-07-02 13:20:21 -05:00
johnjaylward
a8a71898a3
Create LICENSE
2016-06-22 14:49:52 -04:00
johnjaylward
86e8f7b313
Update README
...
fixes typo
2016-06-17 16:39:11 -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
johnjaylward
b3abaa5b4c
Merge pull request #1 from stleary/master
...
update from origin
2016-06-16 11:43:05 -04:00
Sean Leary
eb569b58fc
Merge pull request #236 from madsager/master
...
Make nextString throw a JSONException instead of a NumberFormatExcept…
2016-06-07 21:29:02 -05:00
Mads Ager
16a86d73df
Pass in the throwable that caused the error.
2016-06-02 16:11:15 +02:00
Mads Ager
dfa651e777
Make nextString throw a JSONException instead of a NumberFormatException for malformed input.
2016-06-02 15:56:48 +02:00
Sean Leary
612dafc750
Update JSONObject.java
2016-05-20 21:10:17 -05:00
Sean Leary
808320801a
Update JSONArray.java
...
Update version timestamp
2016-05-20 21:09:53 -05:00
Sean Leary
b2bde1f468
Merge pull request #234 from erosb/master
...
fixing stleary/JSON-Java#233
2016-05-20 21:03:06 -05:00
Bence Erős
56be31e7a8
fixing stleary/JSON-Java#233
2016-05-16 14:53:34 +02:00
stleary
9a81b40334
added some JavaDocs
2016-05-14 11:09:51 -05:00
stleary
4a458a9f1c
add timestamps to recent commits, javadocs for JSONObject, JSONArray queryFrom() methods
2016-05-14 09:22:18 -05:00
Sean Leary
8a72509e6e
Merge pull request #222 from erosb/master
...
JSON Pointer implementation
2016-05-13 22:46:52 -05:00
Bence Erős
c044eb14dd
added copying to JSONPointer constructor
2016-05-05 15:59:43 +02:00
Bence Erős
5ae6a66e38
added javadoc & null check in Builder#append(String)
2016-05-03 23:41:51 +02:00
Bence Erős
d833c2d8de
added builder class for JSONPointer, and implemented toString() and toURIFragment()
2016-05-03 23:18:05 +02:00
Sean Leary
f21ffbe189
Update CDL.java
...
Date of last change.
2016-05-02 22:12:29 -05:00
Sean Leary
cad23423ab
Update JSONObject.java
...
Forgot to update date of last change
2016-05-02 22:11:20 -05:00
Sean Leary
ebf08f5651
Merge pull request #226 from stleary/restore-1.6-compatibility
...
fix to compile with 1.6.0_45
2016-05-01 22:59:29 -05:00
Sean Leary
f239dc75ad
Merge pull request #219 from captainIowa/master
...
Added CSV change to CDL.java
2016-05-01 22:55:13 -05:00
stleary
1ca8933a8f
fix to compile with 1.6.0_45
2016-04-28 22:12:16 -05:00
Bence Erős
cbb1546c53
README improvements for stleary/JSON-Java#218
2016-04-28 16:45:17 +02:00
Bence Erős
c1a789a70c
adding missing license headers
2016-04-27 00:11:47 +02:00
Bence Erős
bff352791c
removed @author tag from JSONPointerException
2016-04-27 00:10:45 +02:00
Bence Erős
5223aadd67
added some javadoc to JSONPointer
2016-04-27 00:10:06 +02:00
Bence Erős
45bd72c15d
added JSONObject#query() and JSONPointer#query() methods
2016-04-26 23:48:14 +02:00
Bence Erős
792c6f6a9c
improved failure handling
2016-04-26 23:32:15 +02:00
Bence Erős
5bee7e3b45
escape handling improvements & URL fragment notation handling
2016-04-26 23:00:16 +02:00
Bence Erős
612e41950c
initial implementation of JSONPointer
2016-04-17 23:21:38 +02:00