This really looks like a Jettison issue.   It might be good to create a 
simple main() method program the just serializes your   
CrystalParameters to the Jettison stream and attach that to a JIRA at 
the jettison bug tracker:
http://jira.codehaus.org/browse/JETTISON

That said, as Sergey mentioned, you MIGHT be able to work around it in 
this specific case by putting an annotation like:

@XmlType(name = "", propOrder = {
    "wavelength",
    "bottomOffset",
    "upperOffset",
    "leftOffest",
    "rightOffset",
    "d2x"
})

To put the d2x stuff at the very end.  

Dan


On Wednesday 19 March 2008, Doug wrote:
> Actually there is something funny going wrong with the JSON
> emitted by the JAXRS process. This was just a dummy service to
> see the output format:
>
> @GET
> @Path("get/{clientId}")
> @ProduceMime("application/json")
> public CrystalParameters dummy(@UriParam("clientId") String id,
> @HttpContext UriInfo info) {
>       CrystalParameters  cpn = new CrystalParameters();
>       MachineData md = new MachineData();
>       md.setWavelength(0.7);
>       md.setD2x(new double[] {1.0,0,0,0,1.0,0,0,0,1.});
>       md.setBottomOffset(50.);md.setUpperOffset(50.);
>       md.setLeftOffset(50.); md.setRightOffset(50.);
>       cpn.setMachineData(md);
>       return cpn;
> }
>
> When I did a wget on this service it gave me JSON:
> {"CrystalParameters":{"machineData":{"bottomOffset":50,"d2x":
> [1,0,0,0,1,0,0,0,1,50,50,50,0.7]}}}
>
> the XML precursor was, from my previous email:
>
> <machineData><bottomOffset>50.0</bottomOffset>
>   
> <d2x>1.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>1.0</d2x>
> <d2x>0.0</d2x><d2x>0.0</d2x><d2x>0.0</d2x><d2x>1.0</d2x>
>    <leftOffset>50.0</leftOffset><rightOffset>50.0</rightOffset>
>    <upperOffset>50.0</upperOffset><wavelength>0.7</wavelength>
>  </machineData>
>
> i.e., the d2x array soaked up all trailing MachineData bean parameters
> in the emitted JSON representation.
>
> So unless there is some JAXB annotation stuff for arrays in java
> beans, I'm guessing both the in and out JSON to XML JAXRS convertors
> may be broken?
>
> Thanks for any info.
> Doug



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to