php - Parsing data bug -


i have following code:

$_request[ 'lom' ] var_dump($_request[ 'lom' ]); 

the result following json:

{    "id":0,    "type":"root",    "related_dropzone_id":0,    "related_dropzone_order":0,    "children":{       "1376071054231":{          "id":"1376071054231",          "type":"section",          "related_dropzone_id":0,          "related_dropzone_order":1,          "dropzones":{             "a":1376071054231          },          "options":{           },          "children":{             "1376071056267":{                "id":"1376071056267",                "type":"section",                "related_dropzone_id":1376071054231,                "related_dropzone_order":0,                "dropzones":{                   "a":1376071056267                },                "options":{                 }             }          }       }    } } 

but when using "correct" following code:

$result = json_decode($_request[ 'lom' ]); var_dump($result);  // result null 

why doesn't convert json array?

i tested way not work:

$result = json_decode( "'" . $_request[ 'lom' ] . "'"); var_dump($result);  // result null 

<?php  $so=$_request[ 'lom' ]; json_decode( $so, true, 9 )     $json_errors = array(         json_error_none => 'no error has occurred',         json_error_depth => 'the maximum stack depth has been exceeded',         json_error_ctrl_char => 'control character error, possibly incorrectly encoded',         json_error_syntax => 'syntax error',     ); echo 'last error : ', $json_errors[json_last_error()], php_eol, php_eol; 

first try code if taking syntax error may helps you;

$so = str_replace('&quot;', '"', $_request[ 'lom' ]); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -