Curl Ggraphql return special character

Topic summary

Issue: When querying Shopify’s GraphQL API, results differ between the Shopify GraphiQL App and curl requests. The GraphiQL App displays properly formatted HTML with readable special characters, while curl returns garbled text with reversed character sequences and Unicode escape sequences (e.g., \u00e9).

Root Cause: The GraphiQL App automatically decodes Unicode escape sequences for human readability, but curl returns raw JSON responses without decoding.

Proposed Solutions:

  1. Use programming libraries to decode Unicode sequences (example provided in Python using json.loads())
  2. Pipe curl output through jq with the -r flag to parse and decode JSON strings directly in command line
  3. Verify request headers - ensure the Accept: application/json header is set correctly

Current Status: The user confirmed they’re receiving data via curl with proper headers and storing results in a database, but the character encoding issue persists. The discussion remains open regarding the best approach to handle the Unicode decoding in their specific workflow.

Summarized with AI on November 16. AI used: claude-sonnet-4-5-20250929.

hi, I don’t understand why from shopify-graphiql-app the result is in html code

{ "key": "body_html", "value": "\nLa Chemise pour Homme Leonardo Essential avec col boutonné en coton Oxford bleu clair est une véritable incarnation du style classique, de l'élégance intemporelle et de l'artisanat italien.\n\n\n\t- **Élégance Classique** : Rehaussez votre garde-robe avec cette pièce essentielle qui incarne sans effort l'élégance classique. Le col boutonné ajoute une touche de sophistication, en faisant un choix polyvalent pour toute occasion.
\n\t- <strong>

but if I do a request from curl the result is different

[{"key":"body_html","value":"\nLa Chemise pour Homme Leonardo Essential avec col boutonné en coton Oxford bleu clair est une véritable incarnation du style classique, de l'élégance intemporelle et de l'artisanat italien.\n\n\u003cul\u003e\n\t\u003cli\u003e\u003cstrong\u003eÉlégance Classique\u003c\/strong\u003e : Rehaussez votre garde-robe avec cette pièce essentielle qui incarne sans effort l'élégance classique. Le col boutonné ajoute une touche de sophistication, en faisant un choix polyvalent pour toute occasion.\u003c\/li\u003e\n\t\u003cli\u003e\u003cstrong\u003eAttrait Intemporel\u003c\/strong\u003e : La Chemise Leonardo Essential est un témoignage du style intemporel, vous assurant de dégager une aura de raffinement qui ne

I need html code

    not \u003cul\u003e

    is a curl problem? is parameter?

Hi CStefano,

When you query from the Shopify GraphiQL App, the app is decoding the Unicode escape sequences for display, making it more human-readable. However, when you fetch the data using curl, you’re getting the raw JSON response, which includes the Unicode escape sequences.

To get the desired HTML format from the curl response, you’ll need to decode the Unicode escape sequences. Here’s how you can handle this:

1. Using a Tool or Library:
Many programming languages have libraries or built-in functions to decode Unicode escape sequences in strings. For example, in Python you could do the following:

import json

raw_data = '[{"key":"body_html","value":"..."}]' # Your raw JSON data here
decoded_data = json.loads(raw_data)
print(decoded_data[0]['value'])

2. Using jq with curl:
If you’re using curl in the command line, you can pipe the output to jq to parse and decode the JSON:

curl YOUR_URL_HERE | jq -r '.[0].value'

The -r flag in jq tells it to output raw strings, decoding any escape sequences.

3. Check Headers and Parameters:
Ensure that you’re setting the Accept header to application/json when making the curl request. This ensures that the server knows you want a JSON response.

curl -H "Accept: application/json" YOUR_URL_HERE

Hope this helps!

Hi thank you for the reply..

the problem is that I receive the data from CURL

curl -X POST -H "Accept: application/json" "https://mysite.myshopify.com/admin/api/2022-04/graphql.json" -H "Content-Type: application/json" -H "X-Shopify-Access-Token: mykey" -d "{\"query\": \"query { translatableResource(resourceId: \\\"gid://shopify/Product/8305135026440\\\") { resourceId translations(locale: \\\"fr\\\") { key value}}}\"}"

and I put the result into a table…