users@jersey.java.net

Json output not always matching xml output

From: Paul Taylor <paul_t100_at_fastmail.fm>
Date: Thu, 12 Nov 2009 14:36:21 +0000

Hi I'm using JSONMarshaller to output the data created from JAXB classes
as JSON. I'm having a problem that sometimes (but not always) the score
attribute is being wrapped in square brackets, I don't have any such
problem when I just marshall
the classes to XML. I dont know much about anything but seems this could
be a bug because I don't do any post-processing of the json output or am
i misundertanding what is valid json output, (Im using
JSONConfiguration.natural())

thanks Paul

i.e JSON output

{"release-group-list":{"offset":0,"count":2,"release-group":[{"type":["compilation"],"id":"765675cc-070b-36e0-829c-69c7634e92ff",*"score":"100"*,
"title":"The History of John Fred and the Playboys",
"artist-credit":{"name-credit":[{"artist":{"id":"05cfb5c7-0152-41f4-a9c9-622e8f710dfa","name":"John
Fred & His Playboy Band","sort-name":"Fred, John & His Playboy
Band"}}]},"release-list":{"count":1,
"release":[{"id":"9cddae0c-1764-41d2-a1c4-0af2a8404e57","title":"The
History of John Fred and the Playboys"}]}},
{"type":["live"],"id":"9856e177-6a63-3141-96da-00b80d08c66e",*"score":["100"]*,
"title":"An Evening With John Kander & Fred
Ebb","artist-credit":{"name-credit":[{"artist":{"id":"0f1d3e45-b3a4-4a93-b29b-06ee9c6e94a8",
"name":"John Kander & Fred Ebb","sort-name":"Kander, John & Ebb, Fred"}}]},
"release-list":{"count":1,"release":[{"id":"a204adf8-2bc7-46cf-b4af-b773bf803a89",
"title":"An Evening With John Kander & Fred Ebb"}]}}]}}


whereas XML output

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
<release-group-list offset="0" count="2">
<release-group type="compilation"
id="765675cc-070b-36e0-829c-69c7634e92ff" *ext:score="100"*
xmlns:ext="http://musicbrainz.org/ns/ext#-2.0">
<title>The History of John Fred and the Playboys</title>
<artist-credit><name-credit>
<artist id="05cfb5c7-0152-41f4-a9c9-622e8f710dfa">
<name>John Fred &amp; His Playboy Band</name>
<sort-name>Fred, John &amp; His Playboy Band</sort-name>
</artist>
</name-credit>
</artist-credit>
<release-list count="1">
<release id="9cddae0c-1764-41d2-a1c4-0af2a8404e57">
<title>The History of John Fred and the Playboys</title></release>
</release-list></release-group><release-group type="live"
id="9856e177-6a63-3141-96da-00b80d08c66e" *ext:score="100"*
xmlns:ext="http://musicbrainz.org/ns/ext#-2.0">
<title>An Evening With John Kander &amp; Fred Ebb</title>
<artist-credit><name-credit><artist
id="0f1d3e45-b3a4-4a93-b29b-06ee9c6e94a8">
<name>John Kander &amp; Fred Ebb</name>
<sort-name>Kander, John &amp; Ebb, Fred</sort-name>
</artist>
</name-credit>
</artist-credit>
<release-list count="1">
<release id="a204adf8-2bc7-46cf-b4af-b773bf803a89">
<title>An Evening With John Kander &amp; Fred Ebb</title>
</release>
</release-list>
</release-group>
</release-group-list></metadata>