BT

Sojo converts Java object graphs into JSON, XML-RPC

| by Rob Thornton Follow 0 Followers on Jan 29, 2007. Estimated reading time: less than one minute |

Sojo, a young project on SourceForge, allows you to convert Java object graphs into a specific structure (CSV, JSON, XML, etc). It also supports cloning whole graphs, filtering graphs to only retrieve certain properties and traversing the graph.

Sojo, which released version 0.3 earlier this month, was cretaed to help Java communicate with other systems by using intermediate forms for objects. Sojo is pluggable to allow you to create your own conversion format. During the conversion, Sojo performs cycle detection. Other uses for Sojo include:

  • Copy of clone object graphs
  • Compare complex object graphs
  • Traverse object graphs

The Sojo user manual provides code snippets for these activities, including copying an object graph:

Node node = new Node("Node");  
Node childNode1 = new Node("Child-Node-1");
Node childNode2 = new Node("Child-Node-2");
node.getChilds().add(childNode1);
node.getChilds().add(childNode2);

Node nodeCopy = (Node) new ObjectUtil().copy(node);

JavaLobby has a post showing how to filter object graphs by property.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT