I have JSON similar to below. I need to get the list of "tenantName" values and add these to a ComboBox. How do I do this in Delphi?
[
{
"id": "e1eede29-f875-4a5d-8470-17f6a29a88b1",
"tenantId": "70784a63-d24b-46a9-a4db-0e70a274b056",
"tenantType": "ORGANISATION",
"tenantName": "Maple Florist",
},
{
"id": "32587c85-a9b3-4306-ac30-b416e8f2c841",
"tenantId": "e0da6937-de07-4a14-adee-37abfac298ce",
"tenantType": "ORGANISATION",
"tenantName": "Adam Demo Company (NZ)",
},
{
"id": "74305bf3-12e0-45e2-8dc8-e3ec73e3b1f9",
"tenantId": "c3d5e782-2153-4cda-bdb4-cec791ceb90d",
"tenantType": "PRACTICEMANAGER",
"tenantName": "Geographe Steelworks",
}
]
Cast the
TRESTResponse.JSONValue
property toTJSONArray
, then loop through its elements, casting each one toTJSONObject
and extracting the desired value from them.