Marshallers
Marshallers are simple pairings of a Serializer and Parser with convenience methods for serializing and parsing POJOs.
T
read(Object,Class<T>)String
write(Object)byte[]
write(Object)Examples
// Using instance.
Json json = new Json();
MyPojo myPojo = json.read(string, MyPojo.class);
String string = json.write(myPojo);
// Using DEFAULT instance.
MyPojo myPojo = Json.DEFAULT.read(string, MyPojo.class);
String string = Json.DEFAULT.write(myPojo);
Juneau comes with the following predefined marshallers:
Each predefined marshaller also includes static convenience from/to methods to make it even easier to perform marshalling on POJOs:
String
of(Object)T
to(Object,Class)Examples
// Using shortcut static methods.
MyPojo myPojo = Json.to(jsonString, MyPojo.class);
String json = Json.of(myPojo);