hendisantika / json-io

Automatically exported from code.google.com/p/json-io
0 stars 1 forks source link

Serializing Maps as Simple JSON Maps #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. class TestClass {public JsonObject<String, String> x;}
2. serialize an instance of TestClass
3. try to deserialize it

What is the expected output? What do you see instead?
serialization works and produces a nice json string, but deserializing the same 
output produces a null x.

it looks like the JsonObject output doesn't produce a @type field, so it just 
returns null when it's injected into TestClass

What version of the product are you using? On what operating system?
2.0.1

Original issue reported on code.google.com by eli...@espoc.com on 2 Apr 2013 at 4:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The json-io library now does allow you to serialize your root JsonObject (Map). 
 This JsonObject is returned when you read into Maps, instead of into Java 
objects.  The library now will serialize this 'map of maps' representation and 
reproduce the original JSON if it is serialized out.

This feature allows you to read in a JSON string from another system that has 
classes that the reading system does not.  By reading into just JsonObjects, 
you can still manipulate the data on the system that does not have the 
corresponding classes, and then re-write the JSON.  This is one of the more 
powerful features of the json-io library.

Original comment by jdereg@gmail.com on 29 Sep 2013 at 1:56