How do i access the JSON parameter?

I have an JSON example which looks like this:

<list>
   <info test1="a" test2="b" test3="c">abc</info><info test1="a" test2="b" test3="c">abc</info>
</list>

How do i access “test3”?

['list'][0]['info'];

Hi, the example you show is not JSON but XML. You could take a look at SimpleXML

$RP = '<list>
   <info test1="a" test2="b" test3="c">abc</info>
   <info test1="a" test2="b" test3="c">abc</info>
</list>';

$xml = simplexml_load_string($RP, ‘SimpleXMLElement’, LIBXML_NOCDATA);
foreach($xml->children() as $resp) {
print_r ($resp);
}

Output will be

SimpleXMLElement Object
(
[@attributes] => Array
(
[test1] => a
[test2] => b
[test3] => c
)

[0] => abc

)
SimpleXMLElement Object
(
[@attributes] => Array
(
[test1] => a
[test2] => b
[test3] => c
)

[0] => abc

)

Sponsor our Newsletter | Privacy Policy | Terms of Service