note 97742 added to function.json-decode

From: Date: Wed, 05 May 2010 23:27:43 +0000
Subject: note 97742 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-168991@lists.php.net to get a copy of this message
In my case, I was passing simple JSON in the URL... eg myfile.php?test=["one", "two", "three"] but I kept getting NULL no matter what I tried. I did a simple echo of $_REQUEST["test"] and noticed that the browser added the "\" to the double-quotes. I had to prepare the data first then do the decode: <?php $data = str_replace("\\", "", $_REQUEST["test"]); $results = json_decode($data); ?> This produced what was expected ---- Server IP: 64.71.164.2 Probable Submitter: 71.81.210.148 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/97742 Del: integrated -- https://master.php.net/note/delete/97742/integrated Del: useless -- https://master.php.net/note/delete/97742/useless Del: bad code -- https://master.php.net/note/delete/97742/bad+code Del: spam -- https://master.php.net/note/delete/97742/spam Del: non-english -- https://master.php.net/note/delete/97742/non-english Del: in docs -- https://master.php.net/note/delete/97742/in+docs Del: other reasons-- https://master.php.net/note/delete/97742 Reject -- https://master.php.net/note/reject/97742 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168991) next »