JSON.parse错误#1132:无效的JSON解析输入(的Flex /动作脚本/ PHP)脚本、错误、动作、JSON

2023-09-08 12:16:46 作者:別扯、扯多了都是事故

我收到错误#1132:无效的JSON解析输入和无法理解为什么

I am getting "Error #1132: Invalid JSON parse input" and cannot understand why.

我的JSON是由PHP生成。 如果显示在文本区(柔性)输出JSON表明这一点:

My json is generated by php: json_encode($x). Output json if displayed in TextArea(flex) shows this:

{
   "title":"The Incredibles",
   "year":"2004",
   "type":"movie",
   "id":"9806",
   "imdb_id":"tt0317705",
   "rating":8.6,
   "tagline":"No gut, no glory",
   "overview":"Bob Parr has given up his superhero days to log in time as an insurance adjuster and raise his three children with his formerly heroic wife in suburbia. But when he receives a mysterious assignment, it\\'s time to get back into costume.",
   "runtime":115,
   "budget":92000000,
   "image":"http:\/\/cf2.imgobject.com\/t\/p\/w185\/jjAgMfj0TAPvdC8E5AqDm2BBeYz.jpg",
   "trailer":"rMfrFG_69zM"
}

我验证了几个验证器和所有的人说,它是有效的JSON。

I validated with several validators and all of them say it's valid json.

在Flex端我试图访问JSON与此code:

On the flex side I am trying to access json with this code:

JSON.parse(event.result.toString());

但得到的错误。有没有人有这个问题?

but get the error. Has anyone had this problem?

编辑1:

看来,概述线是那里的问题,但我不知道到底为什么,因为我用的php json_en code,应正确逃生的事情......

It seems that the overview line is where the issue is but I dont understand why exactly since I used php json_encode which should escape things correctly...

推荐答案

的转义序列\\出现终止JSON。

它\\的它\的如果你想是。

由于此JSON使用的字符串,它可能只是:

Since this JSON uses " for strings, it could just be: it's.

JSON:

{
   "title":"The Incredibles",
   "year":"2004",
   "type":"movie",
   "id":"9806",
   "imdb_id":"tt0317705",
   "rating":8.6,
   "tagline":"No gut, no glory",
   "overview":"Bob Parr has given up his superhero days to log in time as an insurance adjuster and raise his three children with his formerly heroic wife in suburbia. But when he receives a mysterious assignment, it\'s time to get back into costume.",
   "runtime":115,
   "budget":92000000,
   "image":"http:\/\/cf2.imgobject.com\/t\/p\/w185\/jjAgMfj0TAPvdC8E5AqDm2BBeYz.jpg",
   "trailer":"rMfrFG_69zM"
}