Farrukh Najmi wrote:
>
> I have a JAXB object as my response which in normal XML format looks
> like:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <RegistryObjectList ...>
> <RegistryObject ...>
> ....
> </RegistryObject>
> </RegistryObjectList>
>
> When it is marshalled to JSON I get:
>
> {
> "RegistryObject":{
> ...
> }
> }
>
>
> Question is why is it not like:
>
> {
> "RegistryObjectList":{
> "RegistryObject":{
> }
> }
> }
>
> Why is the root element not being marshalled?
>
Hi Guys,
Any help on above questions would be terrific.
I have a related question in understanding the mapping to the default
JSON notation:
Lets say the XML looks like the following where there are no child
element of the root element:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegistryObjectList ... />
Why does above not map to an empty list istead of null?
I expect the following empty set (given the earlier issue that root
element is not mapped):
{
}
Instead I get the following:
null
Can someone please explain the mapping behavior in these edge cases.
They are causing problems downstream because when the URL matches no
RegistryObjects a null is returned instead of empty set and the AJAX
toolkit I am using gets an error.
Thanks for your help.
--
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com