Hi Jakub,
Am 17.06.11 11:36, schrieb Jakub Podlesak:
Thanx for your help :)
> For more recent information on JSON processing configuration
> in Jersey, i would suggest you see [2], try example [3] out
I studied all that and it gave me some insight. But it is about
'generating' JSON from my Jersy resource for the client.
I want to make a HTTP request from inside my Jersey app to an other
REST/JSON API and work with the responded JSON. Imagine I wanna do a
Twitter client with Jersey or such.
What I see: I have to do some mapping with Beans and provide a
JAXBContextResolver for that. But I didn't get it 100%, yet.
I'm trying to understand your code from [1].
What I need is a simple example like:
1. I do a HTTP GET to /foo/bar from my jersey app
2. The Jersey app got from /foo/bar the response string
{"user":{"id":4711,"name":"Weltraumschaf"}}
3. How can I 'convert' this string into an Java Object like:
Object fooBar = someJerseyJsonMagicIDontKnowYet();
Object user = fooBar.user; // {"id":4711,"name":"Weltraumschaf"}
int id = user.id; // 4711
String name = user.name // "Weltraumschaf"
My background is Perl, PHP and JavaScript. In these languages exists
native support for converting a JSON string into native datatypes
(Object,Array,Hash etc.) and viceversa. I understand that in Java it's a
more OOP way which involves some classes/objects to do that work. For
the first part i want to leave out such things like Beans and XML
support, because this is stuff for further study I have to do.
~Sven
--
"Ich habe vom Glauben zum Wissen konvertiert." (Abdel-Samad)