English 中文(简体)
JSON.parse syntax误差,而JSONLint告诉我,json string是有效的。
原标题:JSON.parse syntax error while JSONLint tell me that json string is valid

我利用PHP在功能中的固定功能json_encode(),将一个物体阵列列入json string。 然后,我使用AJAX方法获取xmlhttp.responseText。 I use document.write(xml http.responseText) toeck the response string. 例如,插图如下:

{"index":0,"marks":2}

但是,当我使用<条码>JSON.parse(<>>>,穿戴JSON string时,我就犯了同义词。 因此,我把这一插图复制到JSONLint,以检查其是否有效,结果不是。

Parse error on line 1:
{    "index": 0
^
Expecting  { ,  [ 

但是,当我亲自投入时,这才是有效的。 为什么?

问题回答

http://www.fileformat.info/unicode/char/200b/index.htm

作为说明,我高度建议使用<代码>console.log/code>而不是document.write进行分解。





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes ...

XML DOM parsing br tag

I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...

Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

Locating specific string and capturing data following it

I built a site a long time ago and now I want to place the data into a database without copying and pasting the 400+ pages that it has grown to so that I can make the site database driven. My site ...

热门标签