Select to view content in your preferred language

Escape in JSON For Quotation Mark

4169
10
03-13-2019 11:26 AM
joerodmey
MVP Alum

I want to pass a quotation mark into JSON but the escape methods I'm using don't appear to be working. How do you pass a strong into JSON with a quotation mark?

[

    {
        "attributes": {
            "OBJECTID": 307,
            "Comments": "This is a test "with quotes""
        }
    }

]

0 Kudos
10 Replies
joerodmey
MVP Alum

Thanks for the info. Just included some clarification below.

The screenshot I included above was a sample of a longer JSON string that I created, but I only included the problem section. When I put the entire JSON string through the JSON validator it tells me its valid.

This is a look at what the JSON would be when sending to REST.

[

                {

                                "attributes": {

                                                "OBJECTID": 15,

                                                "Comments": "This is a test"

                                  }

                }

]

This push to REST continues to work for other points (in the same service) and has worked fully in the past. I am hitting the apply edits function of REST so hence the reason for updates. Would features be better option?

I would like the user to have the option to enter double quotes or not enter them without causing issues to JSON syntax either way.

0 Kudos