soo I’m trying to retrieve the data from a Json object from a API. im displaying the json below
[
{
“Message”: “Number of Post office(s) found:5”,
“Status”: “Success”,
“PostOffice”: [
{
“Name”: “Gandhinagaram (Vijayawada)”,
“Description”: null,
“BranchType”: “Sub Post Office”,
“DeliveryStatus”: “Delivery”,
“Circle”: “Andhra Pradesh”,
“District”: “Krishna”,
“Division”: “Vijayawada”,
“Region”: “Vijayawada”,
“State”: “Andhra Pradesh”,
“Country”: “India”,
“Pincode”: “520003”
},
{
“Name”: “Satyanarayanapuram (Vijayawada)”,
“Description”: null,
“BranchType”: “Sub Post Office”,
“DeliveryStatus”: “Delivery”,
“Circle”: “Andhra Pradesh”,
“District”: “Krishna”,
“Division”: “Vijayawada”,
“Region”: “Vijayawada”,
“State”: “Andhra Pradesh”,
“Country”: “India”,
“Pincode”: “520011”
},
{
“Name”: “Vijayawada”,
“Description”: null,
“BranchType”: “Head Post Office”,
“DeliveryStatus”: “Delivery”,
“Circle”: “Andhra Pradesh”,
“District”: “Krishna”,
“Division”: “Vijayawada”,
“Region”: “Vijayawada”,
“State”: “Andhra Pradesh”,
“Country”: “India”,
“Pincode”: “520001”
},
{
“Name”: “Vijayawada Bus Stand”,
“Description”: null,
“BranchType”: “Sub Post Office”,
“DeliveryStatus”: “Non-Delivery”,
“Circle”: “Andhra Pradesh”,
“District”: “Krishna”,
“Division”: “Vijayawada”,
“Region”: “Vijayawada”,
“State”: “Andhra Pradesh”,
“Country”: “India”,
“Pincode”: “520002”
}
]
}
]
after Deserialize JSON Array in UI path, I kept a for loop for accessing each object.
i tried for assigning a variable to store the value of pincode in json format.
varPINCODE=item(“PostOffice”)(“Pincode”).tostring (in for loop)
It displaying the error as:
Message Box: Accessed JArray values with invalid key value: “”. Int32 array index expected.
after this error I modified into varPINCODE=(“PostOffice”)(0)(“Pincode”).tostring
Then it is displaying the first array value only as I mentioned the index to 0.
HOW TO GET ALL THE VALUES IN JSON ARRAY
I’m uploading the file also check if needed
thanks in advance…
happy learning…Main.xaml (12.9 KB)