1
我有两个类似的JSON文件。我可以用json_decode()
阅读其中之一,但不能阅读其中之一。PHP的json_decode()行为奇怪
我上传文件到www.huzursuz.com/json/json_test.rar
如果您想进行检查,brother_a.php
工作,而brother.php
不是。
我不认为问题是json_decode
嵌套的限制,因为文件是如此相似。
我有两个类似的JSON文件。我可以用json_decode()
阅读其中之一,但不能阅读其中之一。PHP的json_decode()行为奇怪
我上传文件到www.huzursuz.com/json/json_test.rar
如果您想进行检查,brother_a.php
工作,而brother.php
不是。
我不认为问题是json_decode
嵌套的限制,因为文件是如此相似。
你从哪里得到那么大的JSON字符串?
按照json_decode
文档,如果JSON是在某些方面畸形的,它只会返回NULL,这是我收到的时候我尝试brother.php
// the following strings are valid JavaScript but not valid JSON
// the name and value must be enclosed in double quotes
// single quotes are not valid
$bad_json = "{ 'bar': 'baz' }";
json_decode($bad_json); // null
// the name must be enclosed in double quotes
$bad_json = '{ bar: "baz" }';
json_decode($bad_json); // null
// trailing commas are not allowed
$bad_json = '{ bar: "baz", }';
json_decode($bad_json); // null
编辑
我通过JSONLint
(一个JSON验证器)运行了两个JSON文件,并且正如所料,brother+a
文件已通过,而brother
在几个位置出现故障。
感谢您的链接,正是我期待这么久...... – 2009-01-21 20:46:43