0
我一直在使用我的android应用程序中的Parse.com数据库,并且我似乎无法在最近几个小时内传递此错误。Parse.com:从服务器检索JSONArray和JSONObject
我想要的只是从Parse.com中检索JSONObject和JSONArray,但我总是收到'illegalStateException',我不知道为什么。我到处寻找,我无法弄清楚我做错了什么。
这是我创作的JSONObejct的:(同去的阵列,但我会救你的麻烦):
JSONObject x = new JSONObject();
try {
x.put("col_1" ,23.234);
x.put("col_2" ,14.34);
} catch (JSONException e) {
Log.e("JSON_CREATION", e.getMessage());
}
newClient.put("fff", x); // This is a ParseObject ojbect, which I later save using
// saveInBackground() (and also tried with 'save()'
上面的代码工作perfectely,我也检查了Parse.Com那确实是一个新的对象,保存了这些特定的值。
现在我所需要的只是让这些数据悲痛。这是我做的:
**JSONObject a = newClient.getJSONObject("fff");** // This line throws 'illegalStateException'
try {
double b = a.getDouble("col_1");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
会appriciate任何帮助。
查看解析文档的“获取对象”部分。查看文档中的查询分析。然后看看你的语句“getJSONObj ...”..为JSON对象的响应调用一个分析查询,而不是你有什么需要指定的地方吗? – 2014-09-04 13:02:01
?我已经有了查询应该返回的parseObject。我的问题是,我无法检索它的一个字段,这是一个JSONObject 谢谢! – Alonbs 2014-09-04 13:24:45