Yes, Java - > JSON is no problem at all using json-lib (btw I am talking about the net.sf json-lib version not the org.json version)
JSON -> to Java is proving more problematic, here are the issues. 1. The bean converter only knows about interfaces not classes as the classes are provided the the data service implementations which are not part of the core social API. Guice knows about them due to the data service implementation adding a module to the injector containing the mappings Person.class binds to PersonImpl.class. This is relatively easy to solve with a NewBeanInstanceStrategy 2. in the Java -> JSON null strings appear as "" in json, easy to solve with a new DefaultValueProcessor bound to the string class 3. Where there is an embedded array eg person.addresses, the json-lib framework provides a number of methods of defining the type of the json->java conversion. It should be a List<Address> going into person.setAddresses(). If I do nothing the List is created correctly and then json-lib cant find the class to fill that list with, it needs a hint. There is a classmap, so I implement a classmap built from the bindings in the Guice injector (point 1 above), however the query into the classmap contains no context, hence, it binds all instances of the key addresses to AddressImpl.class. That might be Ok.... but it feels wrong. If you have any insights, that would be great. The validation of all of this appears to be working well...... but it looks like I can replace it all with jstested... which will be fantastic. Thanks I will go and read all about it. Ian 2008/7/2 Andres Almiray (JIRA) <[EMAIL PROTECTED]>: > > [ > https://issues.apache.org/jira/browse/SHINDIG-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609742#action_12609742 > ] > > Andres Almiray commented on SHINDIG-412: > ---------------------------------------- > > May I ask what problems have you encountered to have json-lib work as a > serializer? > Json-lib includes a JSONSerializer utility class that pretty much takes care > of the hard work. > > Looking at the original description, may I suggest you take a look at > JsTester (http://jstester.sourceforge.net), which was specifically created to > test JS/JSON with Java (via Rhino or Java6's Rhino), as a regular > JUnit/TestNG extension. > >> JSON validator to loading features and validating JSON messages against the >> JSON API >> ------------------------------------------------------------------------------------ >> >> Key: SHINDIG-412 >> URL: https://issues.apache.org/jira/browse/SHINDIG-412 >> Project: Shindig >> Issue Type: Improvement >> Components: RESTful API (Java) >> Reporter: Ian Boston >> Attachments: SHINDIG-412.patch >> >> >> This patch adds the ability to load a feature.xml into a Javascript context >> and scope within the JVM, and then use that loaded Javascript context to >> inspect the JSON tree and evaluate parts of the feature. The aim being to be >> able to write generic Unit tests that can use the Javascript JSON API's to >> act as an 'in unit test' javascript context that will read the json messages >> as if they were inside the browser. > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > >

