i been reading and searching all over the net, and i still can find the best(easiest) way to retrieve this JSON info, if u ask me, the structure of it is very messy coz the ID of blocks, is also a data you need to obtain... =/
{"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"}
}
the problem that i have, is that i need the Block Number as a field the same way i need the other keys... to make a basic table with all the data by rows...
i have this 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);
}
but i get all the fields inside blocks as a huge string =( Please, can someone give me some tips?... thanks!