我正在尝试使用flexjson将以下json字符串转换为java对象:
{"inboundDataNotification": {
"callbackData": "12345",
"inboundData": {
"message": "Hello World",
"messageId": "mes1234"
}
}}
使用以下方法:
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);
} }
调用此方法后,所有字段均为null。任何想法在这里改变什么?