[Java] Need help with JSON

I have a JSON file with the following format:

{
    "auto_extraction_items":[
        {
            "confidence":0.931,
            "name":"demo",
            "value":true
        }
    ],
    "form_id":"16a3c2ab-5054-485d-a1b1-25bf0e9748ca",
    "fields":[
        {
            "confidence":0.9333333333333335,
            "name":"age",
            "region_id":"bffa3918-b136-4e74-86a1-3e7584c2fe7a",
            "type":"script",
            "value":"23"
        },
        {
            "confidence":0.8216666666666668,
            "name":"englishName",
            "region_id":"b719f846-c3a5-4097-9b55-6d28c3f4399b",
            "type":"script",
            "value":"John Doe"
        },
        {
            "confidence":0.28,
            "name":"isPermanentResident",
            "region_id":"b5a73f6f-a89f-4edb-8a9f-2322d1fbe144",
            "type":"script",
            "value":true
        },
        {
            "confidence":0.4,
            "name":"gender",
            "region_id":"99dd75b5-51d3-4120-b33c-bfcc49371a19",
            "type":"script",
            "value":""
        },
        {
            "confidence":0.95,
            "name":"dateOfBirth",
            "region_id":"a86dbfee-631d-40f5-91c7-ac8f5eb41c46",
            "type":"script",
            "value":"1968-01-01"
        }
    ],
    "status":"ok"
}

I am trying to extract the value under the fields but I tried doing this

JSONObject jsonObject = (JSONObject)session.getAttribute("jsonObject");
JSONObject jsonFields = (JSONObject)jsonObject.get("fields");
	
Iterator keys = jsonFields.keys();
while (keys.hasNext()) {
	Object key = keys.next();
	JSONObject value = jsonFields.getJSONObject((String) key);
	String value = value.getString("value");
	System.out.println(value);
}

it returns error:

Exception created : [java.lang.ClassCastException: org.json.JSONArray incompatible with org.json.JSONObject

I am still confused as I can seems to directly access the value by doing fields[0].value