Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.acme;
- class ClassA
- {
- String a;
- String b;
- }
- interface Entity {}
- static class Person implements Entity {}
- Genson genson = new Genson.Builder().setWithClassMetadata(true).create();
- // json will be equal to {"@class":"my.package.Person"}
- String json = genson.serialize(new Person());
- // and now Genson is able to deserialize it back to Person using the information
- // in the Json Object
- Person person = (Person) genson.deserialize(json, Entity.class);
- Genson genson = new Genson.Builder().addAlias("person", Person.class).create();
- // json value is {"@class": "person"}
- String json = genson.serialize(new Person());
Add Comment
Please, Sign In to add comment