JSONDeserializer.use doesn't convert correctly
Posted
by
user530846
on Stack Overflow
See other posts from Stack Overflow
or by user530846
Published on 2010-12-04T23:48:37Z
Indexed on
2010/12/26
19:54 UTC
Read the original article
Hit count: 156
I'm trying to use flexjson to convert the following json string into a java object:
{"inboundDataNotification": {
"callbackData": "12345",
"inboundData": {
"message": "Hello World",
"messageId": "mes1234"
}
}}
Using the following method:
import flexjson.JSONDeserializer;
@RooJavaBean @RooToString @RooJson(fromJsonArrayMethod="", toJsonArrayMethod="", toJsonMethod="") public class InboundData {
private String messageId;
private String message;
public static InboundSMSMessage fromJsonToInboundSMSMessage(String json) {
return new JSONDeserializer<InboundSMSMessage>().use(null, InboundSMSMessage.class).deserialize(json);
} }
All fields are null after this method is invoked. Any ideas what to change here?
© Stack Overflow or respective owner