1

我在以下 JSON 对象上收到“解析错误”。想知道如何解决它。

{
    "Information": [
        {
            "nm": "Earn Goody",
            "st": "y",
            "source": "Internet",
            "story": [
                {
"Don't let the smile fool you. Sabine Lisicki is the proverbial "crazy guy in the fight," at least when grass courts are involved.
Perhaps the only player capable of keeping up with Serena Williams
from a power-and-movement standpoint, Lisicki not only kept up, she
beat Williams, 6-2, 1-6, 6-4, in the Round of 16 at Wimbledon on
Monday.",
"Women's tennis had, like men's tennis, grown predictable recently, with either Williams, Maria Sharapova, or Victoria Azarenka
winning the last six slam titles."
                }
            ]
        }
    ]
}

结果:

{
    "Information": [
        {
            "nm": "Earn Goody",
            "st": "y",
            "source": "Internet",
            "story": [
                {
                    "Don't let the smile fool you. Sabine Lisicki is the proverbial crazyguyinthefight at least when grass courts are involved. Perhaps the only player capable of keeping up with Serena Williams from a power-and-movement standpoint, Lisicki not only kept up, she beat Williams, 6-2, 1-6, 6-4, in the Round of 16 at Wimbledon on Monday.",
                    "Women's tennis had, like men's tennis, grown predictable recently, with either Williams, Maria Sharapova, or Victoria Azarenka winning the last six slam titles."
                }
            ]
        }
    ]
}

Parse error on line 9:
...imbledon on Monday.",                  
-----------------------^
Expecting ':'
4

2 回答 2

2

的“JSON”数据字符串Information[0]/story[0]包含非转义引号 ( ")。那不是有效的 JSON。

在这附近的某个地方:。. . proverbial "crazy guy in the fight," at least. . .

数据字符串中的引号应转义 ( \")。

像这样: 。. . proverbial \"crazy guy in the fight,\" at least. . .

此外story[0]JSON 对象包含没有名称的字段 - 也是无效的。您可以将 JSON 字符串放在大括号 ( { "abc" }) 内。JSON 对象是键值对的集合,其中键是 JSON 字符串 ( { "some-key": "abc" })。

一般来说,参考这里:http: //json.org/

于 2013-07-01T17:51:27.420 回答
1

您可能希望故事数组包含字符串值?在这种情况下,删除数组内的大括号“{}”。

引用的其他评论也适用,但错误消息与无效的数组格式有关。请参阅JSON.org

于 2013-07-01T17:57:46.563 回答