JsonMarshaller: Java 1.5 Marshalling

Written by on March 23rd, 2007 in Ajax News.

JsonMarshaller is a Java 1.5 library that allows marshalling and unmarshalling of JSON objects to and from Java objects. This project’s goal is above all ease of use, transparency and static type safety.

Example

If you have the following Java class:

JAVA:

  1.  
  2. class Book {
  3.   @Value
  4.   private String title;
  5.   @Value
  6.   private String isbn;
  7.   @Value
  8.   private Set<author> authors;
  9. }
  10.  
  11. class Author {
  12.   @Value
  13.   private String firstName;
  14.   @Value
  15.   private String lastName;
  16. }
  17.  

and you created a new Book() and populated it with info it could marshal too:

JSON:

    {title:   "Vocation Createurs",
     isbn:    "2829302680",
     authors: [{firstName: "Barbara", lastName: "Polla"},
               {firstName: "Pascal",  lastName: "Perez"}]}

Source: Ajaxian
Original Article: http://ajaxian.com/archives/jsonmarshaller-java-15-marshalling

Leave a Reply

You must be logged in to post a comment.



Site Navigation