GraphQL `themes` query now Includes comments in JSON response, Unlike REST API, causing parsing issues

We recently migrated from using the REST Asset API to the themes GraphQL query to fetch the config/settings_data.json file for checking if our app embed is enabled. Initially, this approach worked well, as the content returned by the query was a stringified JSON file.

However, we’ve now noticed that the content returned by the themes query includes comments at the top of the JSON file (see attached screenshots). This is causing issues with our JSON parsing, as our code expects a pure JSON format. In contrast, when fetching the same file using the REST API (e.g., templates/product.json), the response contains only the JSON content, with comments automatically excluded.

It seems the behavior of the themes query has changed—it used to exclude comments but no longer does. This is breaking our app. Is there an alternative way to fetch the file in a JSON-only format, or a recommended solution to handle this change?

Rest api response — Screenshot uploaded to CleanShot Cloud
GraphQl api response – Screenshot uploaded to CleanShot Cloud

For now we have migrated back to Asset REST Api to fetch theme assets.

I’m guessing this has to do with this change JSON is better on Liquid themes now — Shopify developer changelog where Shopify added comment and trailing comma support for theme files.

This may be “as designed” but hopefully someone from Shopify can chime in. Otherwise, I’m planning on using something like this ruby json-next library that also supports comments and trailing commas.

Hi Gulam,

Thanks for flagging this and it’s unfortunate you’ve had to migrate back. I’ve connected with the product team who are working on this API and will update here with a path forward for you.