Hello all, I'm hoping to use XStream with the JettisonMappedXmlDriver to deserialize some 3rd party json output.
The json output includes numbers as object names so in my example below
propertyC actually has 3 nested objects but uses a number "1", "2", or "3" as
the object name. In my real world the json usually contains between 100 and
200 of these (it varies).
For instance:
{ "root" : { "propertyA " : "valueA",
"propertyB" : "valueB",
"propertyC" : { "1" : { "propertyC1" : "propertyC1_1_Value",
"propertyC2" : "propertyC2_1_Value",
"propertyC3" : "propertyC3_1_Value"
},
"2" : { "propertyC1" : "propertyC1_2_Value",
"propertyC2" : "propertyC2_2_Value",
"propertyC3" : "propertyC3_2_Value"
},
"3" : { "propertyC1" : "propertyC1_3_Value",
"propertyC2" : "propertyC2_3_Value",
"propertyC3" : "propertyC3_3_Value"
}
},
"propertyD" : "valueD"
} }
Can someone point me in the direction of what I'd have to do to make this work
so that I could have the json deserialized into Java objects. I thought I'd
have the Root object with it's simple properties/fields for propertyA,
propertyB, and propertyD and a collection of propertyC but then I don't know
how to configure a converter and/or aliases to handle the "1", "2","3" , etc
all as the same object. I'd like to build 3 objects of the same type and where
it has an extra property that really represents the object name (the 1, 2 or 3,
etc).
Are there some advance aliasing, converter and/or other tricks I could use to
make this reasonable with xstream and jettison or should I look into other json
converting utilities? I don't want to "preprocess" the json string to change
its format.
Thanks!
Lynn Walton
Java Web Developer
ADP Digital Marketing Solutions
p 850.897.9467 | e [email protected]<mailto:[email protected]>
[cid:[email protected]]<http://adpdealerservices.com/>[cid:[email protected]]<http://cobalt.com/>[cid:[email protected]]<http://bzresults.com/>[cid:[email protected]]<http://cobalt.com/dealix/>
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by email and delete the message and any
attachments from your system.
This message and any attachments are intended only for the use of the addressee
and may contain information that is privileged and confidential. If the reader
of the message is not the intended recipient or an authorized representative of
the intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication
in error, please notify us immediately by e-mail and delete the message and any
attachments from your system.
<<inline: image001.gif>>
<<inline: image002.gif>>
<<inline: image003.gif>>
<<inline: image004.gif>>
