BT

InfoQ Homepage News Sojo converts Java object graphs into JSON, XML-RPC

Sojo converts Java object graphs into JSON, XML-RPC

Bookmarks

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
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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.