I'm looking at the JSON serialization support in Jersey, and I find it a
bit strange. I have basically an object called Choice, with two fields,
called date (String) and type (int).
The object is serialized as follows in JSON:
{"choice":{"date":{"$":"01\/03\/2008"},"type":{"$":"-1"}}}
and for XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<choice><date>01/03/2008</date><type>-1</type></choice>
by the very same function, depending on what Accept: HTTP header it
receives.
I'm wondering why the data values are serialized this way:
"date":{"$":"01\/03\/2008"}
whereas it could be much simpler:
"date":"01\/03\/2008"
and it would be much easier to handle the JSON-generated JavaScript
object hierarchy:
choice.date["$"] vs. choice.date
Akos