我一直在網上閱讀和搜索,我仍然可以找到檢索此JSON信息的最佳方法(如果你問我,它的結構是怎麼把塊的ID很凌亂,也需要獲取數據... =/不知道如何檢索Android中的JSON數據(特別是)
{"blocks":
{"305795": {"is_mature": 1, "total_score": 1, "mining_duration": "1:39:26", "date_found": "2014-06-14 18:25:27", "confirmations": 1, "total_shares": 1, "date_started": "2014-06-14 16:46:01", "reward": "1", "nmc_reward": "0E-8"},
"305796": {"is_mature": 1, "total_score": 1, "mining_duration": "6:17:00", "date_found": "2014-06-15 11:29:32", "confirmations": 1, "total_shares": 1, "date_started": "2014-06-15 05:12:32", "reward": "1", "nmc_reward": "0E-8"}
}
,我有問題,就是我需要的塊號作爲一個字段相同方式我需要其他鍵...做一個基本的表與所有數據按行...
我有這個ATM。
JSONObject json_blocks = json.getJSONObject("blocks");
//Log.e("JSON Debug", "Number of Blocks: " + String.valueOf(json_blocks.length()));
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// looping through All Contacts
Iterator iter = json_blocks.keys();
while(iter.hasNext()){
String key = (String)iter.next();
String value = (String) json_blocks.getString(key);
System.out.println("Key: "+key+" Value: "+value);
map.put(key,value);
}
,但我得到的所有內部塊 請,有人可以給我一些建議嗎?... 感謝字段作爲一個巨大的字符串=(!
檢查這一個http://mrbool.com/how-to-use-json-to-parse-data-into-android-application/28944 –