You might consider using XStream or GSON for that. I prefer the former.
IMHO JSON-lib is really good for working with JSON objects, but not as good at
being a serializer. Serializers have their quirks sometimes too. If your new
to it, I think it is less development time to just write a service to xform
JSONObject to your domain objects. But the trade-off might be in performance
(extra object creation may be involved) and code readabiitiy (some seriaize
mechanisms are pretty easy to read when you work with annotations).
HTH
Tim
----- Original Message ----
From: Alexander Chuprin <a.s...@gm...>
To: jso...@li...
Sent: Thu, August 5, 2010 11:22:25 PM
Subject: [json-lib-user] Transform from JSON to Java
Hello.
I'm using json-lib first time. I need to transform json (string or JSONObject)
to JavaBean.
But i need to transform specific attribute not to primitive class, but to
specific bean.
In example, i have json of Region object: {id: 1, secondaryRegion: 3,
ldapInterface: 212}
Id is a simple integer, but secondaryRegion and ldapInterface more complex type.
I need to transform secondaryRegion to Region bean with id 3 and ldapInterface
to LdapInterfaceModel with id 212.
How i can set transformation to attributes with given name?
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
json-lib-user mailing list
jso...@li...
https://lists.sourceforge.net/lists/listinfo/json-lib-user
|