0

This piece of JSON right here:

{"user":[{"idUser":"1","username":"USERNAME","userFullName":"FULL NAME","userEmail":"EMAIL@MAIL.COM"}]}

Does not validate in jsonlint also not with GWT.

What is strange is that if I delete the first curly brace and type it again, it returns as valid. Here is the error it gives:

Parse error on line 1:
{    "user": [   
^
Expecting '{', '['

Any reason for this? Note that I'm using PHP to generate this string. PHP file used is UTF-8 encoded.

4

2 回答 2

2

When I copy/paste that into JSONLint, it passes.

You did something else wrong.

于 2011-09-06T23:10:12.360 回答
1

感谢@knittl 注意到它。

我有以 UTF-8 编码的 php 文件。

我将其更改为UTF-8 without BOM并且有效。我想当我将它复制到 jsonlint 时会返回一些“垃圾”。

于 2011-09-06T23:19:38.337 回答