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"
}

Everything is ok except for this line

"firstname": "das\' feet"

It has a single quote within double quote. Despite having a \ before the character this json is being invalidated by jsonlint.

edi9999
  • 19,701
  • 13
  • 88
  • 127
Shahid Karimi
  • 4,096
  • 17
  • 62
  • 104
  • 1
    try escaping the slash with another one? "das\\' feet" – n34_panda Jun 06 '14 at 09:14
  • validate if here [jsonlint](http://jsonlint.com/) – Braj Jun 06 '14 at 09:16
  • My logic says escaping the "\" with "\\" essential says string("das\' feet") - As far is I know jsonlint needs a character after the ' to be escabed - try this maybe "das\'s feet" - I know it's not what you want but it may prove the theory – Ryno Coetzee Jun 06 '14 at 09:19

3 Answers3

2

The single quote ' shouldn't be escaped:

enter image description here

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.

JSON.org

As you can see, the single quote shouldn't be escaped.

Or if you want to keep the \, than you need to escape that:

 "firstname": "das\\' feet",
edi9999
  • 19,701
  • 13
  • 88
  • 127
1

there should be double slash to escape slash char

"firstname": "das\\' feet"
Girish
  • 11,907
  • 3
  • 34
  • 51
  • with double slashes it is working here in browser, but the iphone parser fails to parse :( – Shahid Karimi Jun 06 '14 at 09:15
  • @Sarah, is `/` required in first name?, you can also skip `/` from name. **"firstname": "das' feet"** – Girish Jun 06 '14 at 09:18
  • 1
    What iphone parser are you using ? If it doesnt parse the JSON with `das\\' feet` I think it has a problem you should file to them. – edi9999 Jun 06 '14 at 09:20
0

You do not need to escape single quote. More info is here

Eugene Kuzmin
  • 388
  • 3
  • 14