API: Quotes in title causes JSON parse error

If there are quotes in my incident title, the POST request fails.
Post:
Accept: application/vnd.pagerduty+json;version=2
Content-Type: application/json

{ “incident”: { “type”: “incident”, “title”: ““Something Went Wrong Error” with Warrant report (500 - Database error: YEAR)”,

Error:
“error”: {
“message”: “Object format is unrecognized”,
“status”: “unrecognized object”,
“errors”: [
“JSON parse error”
]

JIRA smart values .quote() allows me to format like this, but it still fails with the same error:
“title”: “\Q"Something Went Wrong Error” with Warrant report (500 - Database error: YEAR)\E",

Update. JIRA asJsonString output also fails:
“title”: “”\“Something Went Wrong Error\” with Warrant report (500 - Database error: YEAR)"",

Please help, I’m stuck. Thanks :slight_smile:

I ended up html encoding the text. Not ideal, but at least it works.

Not sure what you are using to generate the serialized JSON but the quotes in the title can be escaped to make them valid. No smart quotes or hard-to-read encoded needed.

{
  "incident": {
    "type": "incident",
    "title": "\"Something Went Wrong Error\" with Warrant report (500 - Database error: YEAR)"
  }
}

Thanks to your help, I realized the problem was extra quotes around the outside. When using the JIRA smartvalue, I didn’t need quotes around it. the asJsonString returns quotes in the string.

Original string: “Something Went Wrong Error” with report (500 - Database error: YEAR)
JIRA automation that fails: “title”: “{{issue.summary.asJsonString}}”,
JIRA automation that works: “title”: {{issue.summary.asJsonString}},