Tuesday, 17 August 2010

Different JSON formats

Found the following examples of different JSON formats here.
@XmlRootElement

public static class SimpleJaxbBean 
{

   public String name = "Franz";

   public String surname = "Kafka";

}
XML output:
<simpleJaxbBean>
  <name>Franz</name>
  <surname>Kafka</surname>
</simpleJaxbBean>
Badgerfish format:
{"simpleJaxbBean":{"name":{"$":"Franz"},
"surname":{"$":"Kafka"}}}
Mapped format (Jettison):
{"simpleJaxbBean":{"name":"Franz",
"surname":"Kafka"}}
and finally Jersey default format:
{"name":"Franz",
"surname":"Kafka"}

No comments:

Post a Comment