decode PHP JSON -


my php receives json string similar this:

{"one-value":"google","sub-values":{"sub thing":"xpto"}} 

how value of "sub thing" ?

if want "one-value":

$json = json_decode($data); $service = $json->{'one-value'}; 

try this:

$json = json_decode(   '{"one-value":"google","sub-values":{"sub thing":"xpto"}}' );  echo $json->{'sub-values'}->{'sub thing'};  // or $json = json_decode(   '{"one-value":"google","sub-values":{"sub thing":"xpto"}}',   true );  echo $json['sub-values']['sub thing']; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -