GraphQL request with syntax error because of ""

Hello,

I’m building a basic translation app that fetches the text from my Shopify store, translates it using CharGPT and then posts it back to Shopify.

I have a silly error and probably the answer is VERY obvious to anyone with coding experience:

From the original text “Cabana T-shirt” I want to translate it to “Camiseta “Cabana”” but having the double “” is creating issues. Anyone knows how to work around this? Ideally without demoving the “”.

Here is a sample of a call that has the issue in the field “value”:

mutation MyMutation {
translationsRegister(
resourceId: “gid://shopify/Product/1707520360546”
translations: {locale: “es”, key: “body_html”, value: “Camiseta “Cabana””, translatableContentDigest: “fe6a55c1f40243e4b9c0a20cb0ae593037d18e828d3b07ee0c1c1387c3f44f13”}
) {
translations {
key
locale
value
}
}
}

You’ll have to “escape” special characters in JSON strings.

One of them is " which should be escaped with a \

value: "Camiseta \"Cabana\""

Some other special characters can be found here


For more information about JSON, see https://www.json.org/json-en.html