0
{
    "already_public": "null",
    "status": "true",
    "message": "Service provider added successfully",
    "detail": {
        "id": "1175",
        "address_1": "",
        "address_2": "",
        "profession": "Accountant",
        "city": "",
        "company": "",
        "email_1": "",
        "email_2": "",
        "firstname": "das\' feet",
        "lastname": "",
        "life_block": "Family",
        "work_phone": "",
        "mobile_phone": "",
        "home_phone": "",
        "fax": "",
        "state": "",
        "title": "",
        "website": "",
        "zip": "",
        "ismyprovider": "1",
        "privacy": "null",
        "img_url": "http://localhost/mtube/uploads/blank_pic.png"
    },
    "inresponseto": "addServiceProvider"
}

一切都很好,除了这条线

"firstname": "das\' feet"

它在双引号内有一个单引号。尽管\在该字符之前有一个 json 被 jsonlint 无效。

4

3 回答 3

1

应该有双斜杠来逃避斜杠字符

"firstname": "das\\' feet"
于 2014-06-06T09:14:12.750 回答
1

'不应转义单引号:

在此处输入图像描述

字符串是零个或多个 Unicode 字符的序列,用双引号括起来,使用反斜杠转义。字符表示为单个字符串。字符串与 C 或 Java 字符串非常相似。

JSON.org

如您所见,不应转义单引号。

或者,如果您想保留 , \,则需要逃避:

 "firstname": "das\\' feet",
于 2014-06-06T09:16:34.080 回答
0

您不需要转义单引号。更多信息在这里

于 2014-06-06T09:19:47.500 回答