We have already seen an example how to iterate TJSONArray elements.
There are following methods and properties of TJSONObject available to loop through the keys and values of JSON objects:
Count – Returns the number of the Key-Values pairs in the JSON object.
Keys[i] – Returns the key value as a string of the pair with index i of the JSON object.
Values[i] – Returns TJSONValue of the pair with index i of the JSON object.
Output
PM1: John Key
PM2: Jacinda Ardern