I have a problem. I wrote the JSON parsing code, but it gives me an error. I don't understand what the problem is. String result is JSON.I need to output the amount value from sum. Returns an error: "JSONObject["sum"] not found."
JSONObject json = new JSONObject(result);
JSONObject bpi = json.getJSONObject("sum");
String uuu = bpi.getString ("amount");
System.out.println(uuu);
{
"data": [
{
"txnId": 20071336083,
"personId": 1,
"date": "2020-10-21T20:10:56+03:00",
"errorCode": 0,
"error": null,
"status": "SUCCESS",
"type": "IN",
"statusText": "Success",
"trmTxnId": "403300256",
"account": "xxx",
"sum": {
"amount": 10,
"currency": 643
}
}
]
}