Hi,
xybrek wrote:
> I'm trying to deserialize a JSON string with XStream like this:
> private <T> T createTObjectWithXStream(Class<T> clazz){
> XStream xstream = new XStreamGae(new JettisonMappedXmlDriver());
> T obj = null;
> try {
> String json = this.toJSONString();
> obj = (T) xstream.fromXML(json);
> } catch (Exception e) {
> LOG.log(Level.SEVERE, "XStream cannot deserialize this object: " +
> e.getMessage());
> }
> return obj;
> }
>
> I need to deserialize the whole String as a type of clazz. However from
> the examples I need to do like:
>
> xstream.alias("product", Product.class);
>
> However, this seems for deserializing specific node, what should be done
> for working on the whole json string? Like
>
> xstream.alias("the_whole_json_stuff", clazz);
>
> Also the result of e.getMessage is 'contentType' what's that suppose to
> mean?
So, what is 'this'? What is 'json'? What do you mean with
"the_whole_json_stuff"?
Sorry, but I don't get a clue what you try to ask.
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email