Joel Leitch
b0f50bb4be
Return a "JsonNull" object for empty whitespace input into the JsonParser.
2009-09-23 19:00:05 +00:00
Inderjeet Singh
fdcd3945c5
Fixed issue 147.
...
Integral values (byte, short, integer, long, BigInteger) are now comparable to each other.
Floating point values (float, double, BigDecimal) are now comparable to each other.
2009-09-23 18:54:01 +00:00
Joel Leitch
50eb582657
Ensure that the JsonElement.toString() will always generate valid JSON (even when control characters/whitespace characters are used).
2009-09-23 18:28:03 +00:00
Inderjeet Singh
3b0f8f4340
Removed all the JDK warnings about unused fields in test classes or unused constructors for use by Gson or instanceof calls on parameterized types.
2009-09-23 17:45:16 +00:00
Inderjeet Singh
29ab864b2f
Fixed bug 158
2009-09-23 17:17:03 +00:00
Joel Leitch
c5812bb485
Fixed Incorrect JavaDoc
2009-09-22 19:10:53 +00:00
Joel Leitch
18b301dfeb
- Serializing of Object arrays.
...
- Fixed incorrect warning
2009-09-22 19:04:27 +00:00
Inderjeet Singh
82771f006c
removed Java 1.5 warnings
2009-08-31 17:51:47 +00:00
Inderjeet Singh
66649a1a62
Moved ancestor tracking into the serialization visitor. Deserialization process doesn't need ancestor tracking since JSON does not allow self-referential structures.
2009-08-31 16:38:50 +00:00
Inderjeet Singh
cbcf7defa3
Updated Grammar for matching JsonArray to be left-associative rather than right-associative. Gson can now parse arrays of size over 11MB instead of 80KB which was the prior limit. Thanks for the tip, kenotron.
2009-08-22 01:03:27 +00:00
Inderjeet Singh
c13fc568c7
Fixed indentation and simplified equals method as per code review comments on r419
2009-08-18 18:07:25 +00:00
Inderjeet Singh
f4f596ec3d
Made JsonParser implement Iterator
2009-08-12 21:01:42 +00:00
Inderjeet Singh
b7cbfc5c34
Fixed Issue 141 by adding new APIs for writing out JSON string representation for JsonElements.
2009-08-07 20:58:41 +00:00
Inderjeet Singh
64172d1dac
Added support to serialize and deserialize array of java.lang.Object when the content is a primitive type.
2009-07-27 23:24:23 +00:00
Inderjeet Singh
4f0728f6a0
Fixed issue 126 by ensuring that parameterized type deduction is not done for transient fields.
2009-06-02 18:02:15 +00:00
Inderjeet Singh
6d50bcea87
Added serialize and deserialize parameters to the Expose annotation that control whether a field gets exposed during serialization or deserialization.
2009-05-19 23:47:53 +00:00
Joel Leitch
376385ac0e
Add a single quote to the HTML set of characters that should be escaped.
2009-05-19 19:49:25 +00:00
Joel Leitch
cd9bd71092
Allow JS Keywords as field name. These names are quoted anyways (and are valid according to the JSON spec) so it should not cause any issues.
2009-05-19 17:59:32 +00:00
Joel Leitch
abf4ab2d78
Fix project so it still compiles with JDK 1.5.
2009-05-19 17:51:02 +00:00
Inderjeet Singh
6e59e502c2
Refactored the Async parser interface out of JsonParser into a new class JsonParserAsync. Updated the JsonParser to detect Eof and return a null instead of throwing a ParseException.
2009-05-14 20:18:45 +00:00
Inderjeet Singh
0127891081
Added a new API method in JsonParser to allow reading of multiple JSON objects on a stream asynchronously.
2009-05-08 22:22:34 +00:00
Inderjeet Singh
b44bbbf5e7
Added an API method to create a tree of JsonElement from an object.
2009-04-03 21:33:01 +00:00
Inderjeet Singh
f418ab69a2
Implementing hashcode and equals for JsonPrimitives as value type equality.
2009-04-03 21:24:38 +00:00
Inderjeet Singh
84f0ddd6bb
Throwing a helpful error in cases where the user forgot to use the TypeToken idiom.
2009-04-01 22:24:10 +00:00
Joel Leitch
5c6d5a0d11
Remove unneeded exception handling in Gson class.
2009-04-01 19:26:10 +00:00
Inderjeet Singh
cee6c74960
incorporated code review comments from r379 by removing the catching of OutOfMemoryError and StackOverflowError in Gson.fromJson. This is obviated since JsonParser.parse catches these errors, and that was the primary source of these problems.
2009-04-01 17:15:01 +00:00
Joel Leitch
e9600e10cb
Made GregorianCalendarTypeAdapter consistent with the other default type adapters.
2009-04-01 17:07:23 +00:00
Inderjeet Singh
149604f0be
Made author tags consistent across the public api.
2009-04-01 17:03:31 +00:00
Inderjeet Singh
85f7c939f6
Renamed JsonParserImpl to JsonParserJavacc for clarity.
2009-03-31 17:58:35 +00:00
Inderjeet Singh
2034090b15
Changed version to 1.3
...
Made JsonParser.parse a non-static method.
2009-03-31 17:53:23 +00:00
Inderjeet Singh
4f727df749
Throwing JsonParseException when the user expected class doesn't match the JSON input during deserialization.
2009-03-27 23:17:46 +00:00
Joel Leitch
c9cb05fc72
Do not leak out a ClassCastException to our clients.
2009-03-27 19:43:33 +00:00
Inderjeet Singh
727dbcdd88
Fixed javadoc for toString() since we do not output valid Json for strings at the moment.
2009-03-20 18:06:52 +00:00
Inderjeet Singh
68f3899c1a
Updated the security token to make generated Json non-executable. Removed the unneeded <data> element at the end.
2009-03-20 18:02:35 +00:00
Inderjeet Singh
b2b2e5dc0a
Implemented enhancement request from issue 42 by supporting a new GsonBuilder setting generateNonExecutableJson() that prefixes the generated JSON with some special text that makes the output non-executable javascript. Gson now recognizes this special text in the input while parsing the JSON in fromJson and filters it out, if present.
2009-03-17 21:15:10 +00:00
Inderjeet Singh
4fc6400f5c
Fixed the test that broke while fixing issue 100 in r394 by using a TreeSet for SortedSets and HashSet for other kind of sets.
2009-03-12 18:17:14 +00:00
Inderjeet Singh
a595032a90
Fixed issue 100 by adding support for deserialization of collections of elements that do not implement Comparable.
2009-03-12 01:59:48 +00:00
Inderjeet Singh
8f456831d4
Fixed Issue 104 by making FieldNamingStrategy to be public and allowing FieldNamingStrategy to be set in GsonBuilder
2009-03-11 21:53:02 +00:00
Inderjeet Singh
809e3b5e21
Fixed bug 106 by adding custom serialization support for Gregorian Calendar.
2009-03-11 21:46:58 +00:00
Inderjeet Singh
16be7167ec
Updated Gson grammar to support floating point numbers without a +/- after the E. So, 1.234567899E8 is now accepted by Gson as a valid floating point number. This fixed the bug http://code.google.com/p/google-gson/issues/detail?id=94
...
Also, updated Gson to use Javacc 4.2.
2009-03-05 23:05:29 +00:00
Inderjeet Singh
2c7cc620d4
Exposed API for JsonParser and added methods to Gson to deserialize from a parse tree.
2009-02-04 01:56:28 +00:00
Inderjeet Singh
f4c21abda6
updated javadoc in response to issue 97
2009-01-29 02:43:36 +00:00
Joel Leitch
764e4d9aca
Performance fixes after doing some profiling.
2009-01-20 08:38:21 +00:00
Joel Leitch
6a80791f13
Code cleanup and some minor performance fixes.
2009-01-20 01:36:54 +00:00
Joel Leitch
2cec661ff0
Removing some unnecessary code.
2009-01-20 01:00:59 +00:00
Joel Leitch
0b1ee35784
Code review suggestions for r361
2009-01-12 17:10:50 +00:00
Joel Leitch
e2cfc0cc19
Update GsonBuilder API to accept an enum for the serialize Long as string. This will be useful if/when we implement support to serialize a long type as an array of integers.
2009-01-11 06:11:29 +00:00
Joel Leitch
90a4619034
Minor fixes for pretty printing.
2009-01-11 05:01:23 +00:00
Joel Leitch
02decace26
Added the ability to deserialize a Map "key" object from a String into a complex Java type.
2009-01-06 07:09:19 +00:00
Inderjeet Singh
cc334475b0
Fixed issue 87 by adding support for deserialization of java.util.Properties
2008-12-31 01:01:57 +00:00
Inderjeet Singh
3690d362b9
incorporated feedback from r358
2008-12-30 22:42:36 +00:00
Inderjeet Singh
e839336eea
Incorporated comments from the code review r355
2008-12-30 19:03:43 +00:00
Inderjeet Singh
05f54f3552
Incorporated code review comments from r350
2008-12-30 18:54:33 +00:00
Joel Leitch
9612bb3601
Removing test file that I didn't mean to add in r355.
2008-12-28 23:14:44 +00:00
Joel Leitch
73d93e3322
Provide a setting to allow a client to skip the escaping of special HTML characters.
...
As well, remove the "/" from the list of special HTML characters since it is causing some incompatibilities.
2008-12-28 23:05:22 +00:00
Joel Leitch
1c87bd5993
Some minor update to our JavaDoc
2008-12-28 06:51:11 +00:00
Joel Leitch
f923f7f537
Add "@since" JavaDoc to the new methods in GsonBuilder.
2008-12-28 03:35:07 +00:00
Joel Leitch
458f2baa2f
Added special serialization of "Long". Now the client has the ability to output a long field as a JSON "String". This is useful for JavaScript clients that need to handle long values.
...
As well, this change does a major clean up of the custom type adapter handling and ParameterizedTypeMap creation.
2008-12-28 03:23:36 +00:00
Joel Leitch
859af0025c
Implement suggestions from self review of r350.
2008-12-28 02:05:40 +00:00
Joel Leitch
54a480774d
Add the ability to configure Gson to exclude serializing and deserializing of all "Inner Classes".
2008-12-28 02:00:31 +00:00
Joel Leitch
73117fe652
Wrapping UUID deserializer in exception wrapper to make it consistent with other deserializers
2008-12-28 00:00:12 +00:00
Joel Leitch
911a92bff9
Removal of all unnecessary "Default" InstanceCreators. While refactoring the code, I found a bug that these InstanceCreators were being called when inside an "Array". This bug is fixed in this change.
2008-12-27 23:43:16 +00:00
Inderjeet Singh
e0195fcc54
code review changes from r342
...
Enabled escaping of /
2008-12-23 18:18:14 +00:00
Inderjeet Singh
51881c7f4a
Added a GsonBuilder setting to enable serialization of special double types, NaN, Infinity, and -Infinity.
2008-12-20 01:26:14 +00:00
Inderjeet Singh
362a94ec74
Added deserialization support for Double NaN, Infinity, and -Infinity
2008-12-19 22:21:35 +00:00
Inderjeet Singh
f33a84c223
Added tests for ensuring that control characters are escaped by Gson.
2008-12-19 20:58:58 +00:00
Inderjeet Singh
e4fdea0fc1
Updated Gson escaper to not escape unicode characters. This is in response to Issue 80.
2008-12-19 20:41:53 +00:00
Inderjeet Singh
6dbdb272c0
Added checks to ensure that we do not serialize NaN or postiive or negative infinity for floats.
2008-12-18 23:41:44 +00:00
Joel Leitch
09720f28cf
Incorporated changes from r307 code review
2008-12-18 20:21:05 +00:00
Joel Leitch
a18a751240
Share the same JsonNull instance with the Gson code.
2008-12-18 20:14:29 +00:00
Inderjeet Singh
cbc6b4d939
Added checks to ensure that we do not serialize NaN or postiive or negative infinity for doubles.
2008-12-18 20:00:27 +00:00
Joel Leitch
0993d729e4
Added @since to the JavaDoc for the new methods added to JsonElement.
...
Suggested in the r296 code review.
2008-12-18 19:25:22 +00:00
Joel Leitch
fc65667d2f
Add support for wildcard type on Maps, Collections and other parameterized types.
2008-12-14 07:12:04 +00:00
Joel Leitch
ea79cd6812
Allow booleans and number to be deserialized into a "String" field/object.
2008-12-14 04:42:16 +00:00
Joel Leitch
0b5f3dc825
Added UUID as a default type supported by Gson.
2008-12-13 20:42:31 +00:00
Joel Leitch
d16553701b
Performing automatic refactoring using the IDE tools which does not take resources into consideration. This fixes the JavaCC Parser definition.
...
Goes with r325.
2008-12-02 23:48:10 +00:00
Joel Leitch
11a29b63b0
Implemented suggested changes from r324 code review.
2008-12-02 23:41:04 +00:00
Joel Leitch
b9e81f93c1
Fixed warnings and updated some JavaDoc.
2008-12-01 01:40:11 +00:00
Joel Leitch
6f59bc3bfe
Added "Until" type version. This new annotation allows you to remove members from the JSON output beginning at a certain version number.
...
This new annotation work in conjunction with the "@Since" annotation.
2008-12-01 00:10:04 +00:00
Joel Leitch
5ae7e1f803
Adding new convenience method to JsonObject for adding Booleans and Characters.
2008-11-30 23:36:29 +00:00
Joel Leitch
b90228dcc0
Enable serialization of nulls within Maps.
2008-11-30 23:01:14 +00:00
Joel Leitch
c9e48097ec
Do not overwrite a duplicate field value during seriailzation if one those fields is null.
2008-11-27 00:50:50 +00:00
Joel Leitch
b506183d94
Move isPrimitiveOrString() method from ObjectNavigator to JsonPrimitive.
2008-11-27 00:40:31 +00:00
Inderjeet Singh
9bcbb4cfdc
Fixed issue 52 by switching Gson.toJson methods to use Appendable instead of java.io.Writer
2008-11-26 19:13:14 +00:00
Inderjeet Singh
59be02d4de
Added support for accepting Object field names without quotes. Issue 41.
2008-11-26 17:52:46 +00:00
Joel Leitch
2effd57976
Deserialization will no longer call the default constructor or InstanceCreator if the object being deserialized has a custom deserializer.
2008-11-25 18:42:47 +00:00
Joel Leitch
0c98c2f8d1
More lenient parsing of Numbers and Booleans. Basically, can deserialize properly formatted stringr representations of numbers and booleans.
2008-11-20 19:40:12 +00:00
Joel Leitch
2250afe825
Allow serialization of Object in collections. This used to be supported before restructuring the Collection type handling.
2008-11-20 01:06:21 +00:00
Joel Leitch
3df2d44e40
Adding a "remove" method to the JsonObject class. Created a unit test to ensure it is functioning properly.
2008-11-19 01:22:21 +00:00
Joel Leitch
d5319d9e84
Parse all JSON numbers as either BigDecimal or BigInteger. From there we can properly convert into the proper primitive type if need be. This reduces the chance of losing precision with floating point numbers.
2008-11-18 20:26:15 +00:00
Joel Leitch
628a2c5b86
Added default serializer/deserializer for "Number"
2008-11-18 20:05:02 +00:00
Joel Leitch
788d2bfbbb
Fix parsing of double and big decimals that have an exponent but no fraction part.
2008-11-18 19:55:14 +00:00
Joel Leitch
cf2a457af7
Removed the TypeAdapter object from GSON now that the primitive objects and fields are created by a custom Type Adapter.
2008-11-15 05:11:28 +00:00
Joel Leitch
0d8150fe52
Major restructuring of Primitve type serialization and deserializtion. From the end-user's point of view there should be no difference other than the user can now override the default serialization/deserialization their own custom type adapter (not sure if there is a real use-case out there for this).
...
This restructuring greatly cleans up the code and reduces some complexity; however, there is more that can be done to clean this up (i.e. get rid of "InstanceCreators" for primitive Type Adapters).
2008-11-15 02:26:57 +00:00
Inderjeet Singh
3ff6bda2ad
Added equals and hashcode to JsonNull to ensure all instances of this class are the same.
2008-11-14 22:33:39 +00:00
Inderjeet Singh
9a69560d9f
During serialization, we now dont call custom serializers the field is null.
...
During deserialization, we do not call custom deserializer if the field is to be set to null. Moreover, changed the logic to set fields to null only if explicitly indicated in the incoming Json. This is different from past behavior where all fields not mentioned in incoming Json were set to null. Now they are set to whatever the default constructor will do.
2008-11-14 20:52:57 +00:00
Inderjeet Singh
e4ea6b1fd0
removed unused code.
2008-11-14 02:43:32 +00:00
Inderjeet Singh
6fa09b5ef6
Removed specialized handling of Enum types with the EnumTypeAdapter
2008-11-14 02:37:59 +00:00
Inderjeet Singh
40b77dfa6b
removed unused endVisitingObject method.
2008-11-14 02:32:48 +00:00
Inderjeet Singh
bcd1baefd5
deleted unused visitCollectionField method in the visitor. All of this functionality has now been replaced with the default CollectionTypeAdapter
2008-11-14 02:30:28 +00:00