I have a struts action receiving following JSON:
{
"commandId":"tC",
"id":"123",
"def":""
}
法典颁布后,仅罚款:
JSONObject command = null;
String commandId = null;
String deviceId = null;
try {
command = new JSONObject(json);
commandId = command.getString("commandId");
}
由于
JSONObject def = command.getJSONObject("def");
in order to get this JSON object defined in the element def
这只有
{
"commandId":"tC",
"id":"123",
"def":{"1":"aaa", "2":"bbb"}
}
当JSONObject def = 指挥.getJSONObject(`def');
,并注意到它没有继续执行?
If I put JSONObject def = command.getJSONObject("def");
try / catch block I get _JSONObject["def"] is not a JSONObject _ exception, but execution doesn t continue
How does JSONObject.getJsonObject(String)
behave?
我期望它归还一个空洞的JSONObject,并继续处决。
我想检查一下的是,是否在def中界定了任何内容,然后,如果是的话,则根据在我的节目中发现的价值决定什么。 如果一个客户的 j在