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:

2 Likes

Thank you for the response. This worked.

1 Like

Hi @bpricilla,

I have 2 same elements on the same hierarchy levels and need to fetch value of 2nd element(<a:OutCustomer) from XML response. Can anyone help me in this?

This was really helpful… Thanks

1 Like