I\'m having some issues reading from a Firebase Database.
I have a pretty simple layout
{
\"lot\" : {
\"lot1\" : \"low\",
\"lot2\" : \"low\",
you can use typecast to JSONObject
and parse the JSONObject
JSONObject jsonObject= new JSONObject((Map)dataSnapshot.getValue());
JSONObject jsonObj= (JSONObject) jsonObject.get("lot");
for (Object key : jsonObj.keySet()) {
//based on you key types
String keyStr = (String)key;
Object keyvalue = jsonObj.get(keyStr);
//Print key and value
System.out.println("key: "+ keyStr + " value: " + keyvalue);
}
if you using java 8 than you use lamada expression.