Escaping double quotes in Shopify GraphQL mutation when passing CSV data

:bullseye: What is your goal?

I have a scenario that:

Retrieves a CSV file from SFTP, parses the CSV and runs a Shopify GraphQL mutation to configure/create products

The goal is to set the product title dynamically from a CSV column (e.g. {{2.col6}}) inside the GraphQL productSet mutation.

:thinking: What is the problem & what have you tried?

The scenario works fine unless the product title contains double quotes. Example: 16" Table Lamp.

Because GraphQL uses double quotes for string values, the mutation breaks when a title contains ". The query becomes invalid and fails.

I’ve tried:
Escaping with "
Using / as an escape
Trying triple quotes

However, in the module input preview it appears the value is still being sent without escaping, and the query fails.

Here’s the relevant part of the mutation:

mutation ConfigureProduct {
productSet(
input: {
title: “{{2.col6}}”
status: ACTIVE…

:clipboard: Error messages or input/output bundles

[200] Error(s):
syntax error, unexpected IDENTIFIER (“Sconce”), expecting COLON at [4, 31]

1 Like

Hey there,

usually its \ and not / to escape something. Try replacing " with " instead and see if it will work.

Can you also share what the api call looks like when that error happens? But yeah, the error sounds like an unexpected " closed a JSON and broke it.