[Solved] Parsing JSON String Android [duplicate]


I suggest Use JSONObject keys() to get the key and then iterate each key to get to the dynamic value.

according to your json string code must be something look like this:-

//refers to the current element in the array "data"
JSONObject mainObj = new JSONObject(yourString);
JSONObject dynamicValue1 = mainObj.getJSONObject("dynamicValue1");
Iterator key = dynamicValue1.keys();

while(key.hasNext()) {
    // loop to get the dynamic key
    String currentDynamicKey = (String)key.next();

    //get value of the dynamic key
    JSONObject currentDynamicValue = dynamicValue1.getJSONObject(currentDynamicKey);

    // here do something  with the other value...
}

I suggest to you can try this solution.

solved Parsing JSON String Android [duplicate]