John J. Aylward
34cfe6df14
removes duplicate code in number getters
2018-10-04 16:02:14 -04:00
John J. Aylward
30c1bd16ba
fix javadoc
2018-10-02 15:28:53 -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
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
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
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
Philipp Gillé
15719886f7
Remove wrong apostrophe
2018-01-17 18:41:48 +01:00
John J. Aylward
4a4b2db8c1
fix for issue #379
2017-11-06 10:28:28 -05:00
John J. Aylward
057e0c75ca
Merge remote-tracking branch 'origin/master' into AndroidSupport
2017-10-27 13:28:20 -04:00
Miguel
2e0a8137bd
Removed JSONTokener.back()
2017-08-14 13:01:31 -04:00
Miguel
f177c97258
Replacing tabs with 4-spaces
2017-08-10 19:12:41 -04:00
Miguel
7d8353401a
Adding JSONTokener.back() just before throwing JSONException
...
This forces JSONTokener.syntaxError(..) to point to the last character of the duplicate key.
2017-08-10 19:05:57 -04:00
Miguel
7fed023080
Update to include error location when creating JSONObject from string/text
2017-08-09 21:52:36 -04:00
Sean Leary
d9b8507e6a
Merge pull request #354 from johnjaylward/PopulateMapMoreStrict
...
Updates for populateMap based on discussion in #279 and #264
2017-07-19 18:57:32 -05:00
John J. Aylward
6f238a3698
Update javadoc according to issue #356 .
2017-07-15 12:17:27 -04:00
John J. Aylward
5c80c9157d
fixes malformed javadoc
2017-07-09 18:47:09 -04:00
John J. Aylward
a129ebe8e4
Adds check for resources opened by our bean mapping
2017-07-09 18:09:14 -04:00
John J. Aylward
641b68dd55
updates javadoc.
2017-07-07 21:33:46 -04:00
John J. Aylward
643b25140f
Updates for populateMap based on discussion in #279 and #264
2017-07-07 20:48:42 -04:00
John J. Aylward
e8b1b66888
Updates for supporting the Android API
2017-07-07 12:17:39 -04:00
Sean Leary
1add1247fa
Merge pull request #348 from johnjaylward/ArrayPerformance
...
Capacity improvements for internal structures
2017-06-12 02:05:26 -05:00
Sean Leary
5b2e5e7579
Merge pull request #347 from ttulka/master
...
a comment added to explain the use of HashMap
2017-06-11 23:32:06 -05:00
Tomas Tulka
246350bbcd
comment added to explain the reason that JSON object is unordered
...
to avoid implementators' misconceptions and tries to reimplement the
JSON object to keep the elements order
2017-06-09 09:00:17 +02:00
John J. Aylward
2fbe4d96cf
change JSONObject(Map) constructor to use the default capacity when a null map is passed
2017-06-08 12:18:04 -04:00
John J. Aylward
9c092753b0
* Updates array constructor and bulk operations to best guess capacity information
...
* Update JSONObject to allow best guess for initial capacity.
2017-06-08 11:22:23 -04:00
Tomas Tulka
d0f5607998
a comment added to explain the use of HashMap
...
to avoid misconception of contributors about using HashMap to implement
a JSON object as a unordered collection by the definition
2017-06-08 08:03:14 +02:00
John J. Aylward
ad6bdd715d
Adds JSONException for write value errors so serialization errors can be tracked easier
2017-06-05 20:51:57 -04:00
John J. Aylward
f76fbe7005
fixes comments
2017-05-31 18:13:40 -04:00
John J. Aylward
4f5bf16676
* Adds protected entrySet accessor to JSONObject
...
* Updates loops that request key/value pairs to use the new entrySet accessor
2017-05-23 12:48:44 -04:00
John J. Aylward
757b6edb03
Merge branch 'master' of github.com:stleary/JSON-java into OptimizeOpt
2017-05-21 13:12:24 -04:00
John J. Aylward
849b392c01
updates the getNumber/optNumber to not return invalid Doubles
2017-05-18 19:49:50 -04:00
John J. Aylward
a7f8ff24df
correct string check for JSONObject optBigDecimal and optBigInteger
2017-05-18 14:41:42 -04:00
John J. Aylward
1ab5260a7a
* Adds methods getNUmber and getFloat to JSONArray and JSONObject
...
* Extracts the stringToNumber logic that the optNumber method uses to reuse it between classes
* Fixes -0 issue with optNumber/getNumber
2017-05-18 14:24:34 -04:00
John J. Aylward
c28a2bdf39
* reverts changes to getDouble and related optDouble and optFloat
...
* Updates optNumber to be smarter about which object it uses to parse strings
2017-05-18 13:07:32 -04:00
John J. Aylward
382f62e781
* Prevent exceptions in cases where the value is not a string.
...
* Don't call toString when we know it's a string, just cast
2017-05-18 11:41:51 -04:00
John J. Aylward
0c7bd725a6
fixes for javadoc
2017-05-17 11:34:37 -04:00
John J. Aylward
fcdb8671b2
grr, forgot to save changes on last commit
2017-05-17 11:32:44 -04:00
John J. Aylward
c46774cf13
* Update opt* methods for JSONArray
...
* Add support to JSONArray and JSONObject to optionally get raw number values
* Add support to JSONArray and JSONObject to optionally get float values
2017-05-17 11:29:26 -04:00
John J. Aylward
bd4b180f4e
Support for float to BigDecimal in optBigDecimal
2017-05-17 10:51:06 -04:00
John J. Aylward
a8d4e4734f
adjustments to opt methods in reference to https://github.com/stleary/JSON-java/issues/334
2017-05-16 19:38:01 -04:00
John J. Aylward
4865f51dd5
change float double literals to be more standard as 1.0f and 1.0d respectively
2017-05-16 15:38:54 -04:00
John J. Aylward
c870094f69
Fixes spelling in comments and removes compile time warnings
2017-05-16 15:35:05 -04:00
alessandro rao
9e0fc5e680
Allow user to invoke query and optQuery ,with a JSONPointer,directly
...
from JSONArray or JSONObject
2017-02-25 13:27:50 +01:00
John J. Aylward
eb806f4c14
make sure locale independent data is not upper/lowercased incorrectly. See #315
2017-02-10 10:07:28 -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
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
349a209df3
Merge remote-tracking branch 'upstream/master' into EnumCleanup
2016-08-15 10:25:27 -04:00