cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTCINW)" <dk0...@att.com>
Subject RE: How to make clean json, instead of xml-ish json?
Date Thu, 01 Oct 2009 16:27:37 GMT
> -----Original Message-----
> From: KARR, DAVID (ATTCINW)
> 
> I have a REST prototype using CXF that produces reasonable looking
XML,
> and almost reasonably looking JSON.  The JSON it produces is
"xml-ish".
> 
> For instance, the sample XML I get is the following:
> 
> <Item>
>  <description>def</description>
>  <features>
>   <feature>123</feature>
>   <feature>456</feature>
>  </features>
>  <id>1</id>
>  <title>abc</title>
> </Item>
> 
> The JSON is this:
> 
>
{"Item":{"description":"def","features":{"feature":[123,456]},"id":1,"t
> i
> tle":"abc"}}
> 
> A nicer JSON result would have been this:
> 
>
{"Item":{"description":"def","features":[123,456],"id":1,"title":"abc"}
> }
> 
> Is it possible to modify just the JSON results, but still have the
"out
> of the box" XML results?

Related to this, I noticed the "Dealing with JSON array serialization
issues" section in the user guide.  I have a feeling this is telling me
that setting "serializeAsArray" and "arrayKeys" in my JSONProvider.  I'm
building a test for this now.  Even if this works, I'd have to say that
this documentation could use a clearer explanation of this, perhaps with
more fully-elaborated examples.  The documentation for this is quite
brief.  Full examples showing "before" and "after" would be useful.
There is a link to another example that supposedly provides more info,
but it only shows the beans.xml file, without any elaboration or
example.

Mime
View raw message