note 89122 rejected from function.json-decode by thiago
| From: | thiago@php.net | Date: | Mon, 23 Feb 2009 14:56:57 +0000 |
| Subject: | note 89122 rejected from function.json-decode by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151013@lists.php.net to get a copy of this message | ||
Note Submitter: iisfirewall at 126 dot com
----
eg1:
$json = '
{
"iisuser.com":"A\\B"
}
';
var_dump(json_decode($json, true));
result:
===================================
string(29) " { "iisuser.com":"A\B" } "
===================================
look at: string not a array
my version: 5.2.6
so the right way is:
add one \ to \\ it become:
$json = '
{
"iisuser.com":"A\\\B"
}
';
var_dump(json_decode($json, true));
===================================
array(1) { ["iisuser.com"]=> string(3) "A\B" }
===================================
why? \\ in string,it is will be \,but it is in '........'
then json_decode will do the same action!
from www.iisuser.com