0

I have the following code:

$_REQUEST[ 'LOM' ]
var_dump($_REQUEST[ 'LOM' ]);

the result is the 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 the "correct" following code:

$result = json_decode($_REQUEST[ 'LOM' ]);
var_dump($result);  // the result is NULL

Why it doesn't convert the JSON into an array?

I tested this way but not work:

$result = json_decode( "'" . $_REQUEST[ 'LOM' ] . "'");
var_dump($result);  // the result is NULL
4

2 に答える 2

0

@merdinczに感謝します。

次のコードで解決しました:

var_dump( json_decode( str_replace( '\\', '', $_REQUEST[ 'LOM' ] ) );
于 2013-08-09T20:27:40.713 に答える