How to read the data from Json response

I have to read the data inside the array from below response.
I am trying "response.validationResponsesMap.individual.name.lastName[0].ruleType. This is not working for me. Can some one help me out on how to read such response.

      "validationResponsesMap": {
        "individual.name.lastName": [
            {
                "errorMessage": "Missing value for required field: individual.name.lastName",
                "ruleType": "REQUIRED",
                "fieldValue": "",
                "sequence": 0,
                "id": "",
                "shortCode": ""
            }
        ],
        "individual.name.firstName": [
            {
                "errorMessage": "Missing value for required field: individual.name.firstName",
                "ruleType": "REQUIRED",
                "fieldValue": "",
                "sequence": 0,
                "id": "",
                "shortCode": ""
            }
        ]
    },
    "requiredDocumentsList": []
}

@amitesh1505 Welcome to the community :partying_face:

For array objects you can access using dot notation or bracket notation. When the attribute name contains “.” in it, its advised to use bracket notation in JS. You can find more info here.

Similar thread is discussed here and another one.

Something like the below snippet in your case

response['validationResponsesMap']['individual.name.lastName']['ruleType']

Let us know if you still face any issue here in parsing the response :slight_smile:

1 Like

Thank you for the response. This worked.

1 Like