The flowing array is stored in var $items (plus more).
"c74a0dba-5407-4f90-b04e-fdc88c4dd434": {
"0": {
"value": "Suffolk"
}
},
"91866e91-70d7-405f-900c-475d0c027399": {
"country": {
"0": "GB"
}
},
To view the array i can use:
$county = json_decode($items);
var_dump($county);
This prints
[c74a0dba-5407-4f90-b04e-fdc88c4dd434"]=> object(stdClass)#24 (1) { ["0"]=> object(stdClass)#25 (1) { ["value"]=> string(15) "Suffolk" } } ["91866e91-70d7-405f-900c-475d0c027399"]=> object(stdClass)#26 (1) { ["country"]=> object(stdClass)#27 (1) { ["0"]=> string(2) "GB" } }
I need to extract the county info 'Suffolk' using its unique identifier.
I attempted the below but it produces a server error
$result_county = $county->getElement('c74a0dba-5408-4f90-b04e-fdc88c4dd434')->getElementData()->get('value');
The below is a var_dump of the whole array. The identifier c74a0dba-5408-4f90-b04e-fdc88c4dd434
is the same for each item array.
object(stdClass)#2 (18) { ["4d612549-f4cd-4487-ba42-f091ece35391"]=> object(stdClass)#3 (1) { ["0"]=> object(stdClass)#4 (1) { ["value"]=> string(13) "East Newlem" } } ["5eb77708-72e8-4587-b65e-ee50eb0f9e6d"]=> object(stdClass)#5 (1) { ["0"]=> object(stdClass)#6 (1) { ["value"]=> string(24) "Hillside Estate" } } ["520720dc-c480-405a-ac56-bf317f48d860"]=> object(stdClass)#7 (1) { ["0"]=> object(stdClass)#8 (1) { ["value"]=> string(17) "11 Rees Drive" } } [ECT...
Any ideas?