Skaringa is an API for Java, JSON and XML language binding.
It transforms Java objects into JSON or XML documents and back, and can generate XML schema definitions for Java classes.
Typical applications are data exchange, object persistence, object transformation, and driving XML or JavaScript based presentation layers.
Skaringa is designed for speed and simplicity, supporting a wide range of types. Skaringa works with all Plain Old Java Objects (POJOs), it is not limited to special cases, like JavaBeans.
Person fred = new Person(); ObjectTransformer trans = ObjectTransformerFactory.getInstance().getImplementation(); FileOutputStream out = new FileOutputStream("fred.xml"); trans.serialize(fred, new StreamResult(out)); out.close();
FileInputStream in = new FileInputStream("fred.xml"); Person freddy = (Person) trans.deserialize(new StreamSource(in)); in.close();
out = new FileOutputStream("Person.xsd"); trans.writeXMLSchema(Person.class, new StreamResult(out)); out.close();
trans.setPostprocessorInstruction(new StreamSource( ClassLoader.getSystemResourceAsStream("Person2OrgMember.xsl"))); OrgMember fredTheMember = (OrgMember) trans.transform(fred);
Person fred = new Person(); ObjectTransformer trans = ObjectTransformerFactory.getInstance().getImplementation(); OutputStream out = new FileOutputStream("fred.js"); trans.serializeToJson(fred, out); out.close();
FileInputStream in = new FileInputStream("fred.js"); Person freddy = (Person) trans.deserializeFromJson(in, Person.class); in.close();
See the developer guide for a detailed description and examples. Other project activities, like news, download, CVS access, forums, bug tracker, etc., are accessible via the project page at SourceForge.net.