cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pipes, David" <dpi...@AimNTLS.com>
Subject RE: What JSON library are you using with cayenne?
Date Fri, 02 Sep 2011 13:18:17 GMT
Hello Christian, That's for this information. I downloaded your jjson code and was testing
it a bit. I was looking for something that I didn't have to use annotations with (personal
dislike or annotations). It seems to work great for the test cases from the source. But I
am unable to get it to work with my current CayenneDataObject classes with or without annotations.

Here is an example of what I mean.

private String getJsonExample(){
  Gson gson = new Gson();
  List<Webdvcr> test = Webdvcr.getDvcrByUnitNum("502");				
  // returns a Webdvcr object that is extended from CayenneDataObject
  return gson.toJson(test);
}

In this example with GSON it works perfect and this is what I'm trying to get yours to do.
getDvcrByUnitNum is a method in the class that extends my "_Webdvcr" class. Now what I am
asking is it possible with your jjson to replicate the above code without using annotations?
Or if it can't how could I replicate it using annotations. I thought I had them set correctly
but it only returned "[,]" as the value. 

Thanks.


-----Original Message-----
From: Christian Grobmeier [mailto:grobmeier@gmail.com] 
Sent: Thursday, September 01, 2011 10:20 AM
To: user@cayenne.apache.org
Subject: Re: What JSON library are you using with cayenne?

Hello David,

On Thu, Sep 1, 2011 at 4:00 PM, Pipes, David <dpipes@aimntls.com> wrote:
> What are you all using for your JSON library with cayenne? I am looking for some feedback
on what works well out of the box or with little work. I can't seem to find a good JSON library
that works well with cayenne and db2 on an as400. My initial research pointed me to GSON (Google
JSON library). This worked amazingly well right out of the box on my local server (windows).
Once we added it to our production server on the 400 it didn't seem to work. Then I tried
JACKSON. It looked promising but not easily configurable with parent child relationships in
cayenne with circlular references.
>
> So, I'm looking for one of two things here. What libraries are you using or has anyone
had success with GSON on the as400? I would prefer to use GSON for its simplicity but am also
welcoming feedback on both.

actually I always had problems with the other JSON libs out there, so I wrote my own:
http://code.google.com/p/jjson/
It uses plain Java without dependencies, so you have a good chance to make it work on AS400.

You can use the @JSON annotations on the properties you want to expose as JSON. I use the
classes for it which extend the _UnderScoreClases, overwrite and annotate the getters. This
worked pretty well for me.

Let me know if I can help more

Cheers
Mime
View raw message