Free Webhook JSON Escaper & Stringifier Tool
If you are building B2B automations connecting to strict APIs (like Shopify’s GraphQL, Jira, or custom HubSpot objects), you have likely hit a wall with an HTTP 400 Bad Request or Malformed JSON error.
This happens when an API endpoint expects a JSON payload to be passed as a string rather than a nested object. Use the live escaper tool above to instantly validate, minify, and inject the necessary backslashes (\") into your JSON, making it perfectly safe for GraphQL variables or nested webhook payloads.
Why Your Webhook is Throwing a “Malformed JSON” Error
When you use the HTTP Request node in n8n or Make.com, the visual builder tries to help you by automatically formatting your JSON objects. However, this “help” ruins your payload when dealing with specific enterprise APIs.
A 400 Malformed JSON error usually occurs for one of three reasons:
- Unescaped Quotes: You placed a double quote (
") inside a value without escaping it with a backslash (\"). The server reads the rogue quote and thinks the JSON object has ended prematurely. - Rogue Newlines: Your JSON payload contains invisible line breaks (
\n) or carriage returns that the receiving server’s parser rejects. - Nested Object Rejection: The receiving database column is set to accept a
String(Text), but you are sending it anObject(JSON Array/Dictionary).
The Difference Between a JSON Object and a Stringified Payload
To fix your webhook, you must understand how the receiving server reads data.
Standard JSON Object (What humans read):
Json
{
"custom_data": {
"plan": "enterprise",
"seats": 10
}
}
Stringified JSON Payload (What strict APIs demand):
Json
{
"custom_data": "{\"plan\":\"enterprise\",\"seats\":10}"
}
Notice the difference? In the second example, custom_data is no longer an object containing keys. It is a single, flat string of text. The double quotes inside the string must be “escaped” using backslashes so they do not break the outer quotes. Our tool above performs this exact conversion automatically.
How to Escape JSON Automatically inside Make.com or n8n
You do not need to manually paste your payloads into this tool every time your automation runs. You should build this escaping logic directly into your iPaaS workflow.
In Make.com (Integromat)
Make.com has a native function designed exactly for this. Do not use the toString() function—it will often output [object Object], which ruins your API call. Instead, use the built-in JSON function:
{{ toJSON(1.custom_data_array) }}
This instantly converts the mapped array from a previous module into a perfectly minified, escaped string that you can map into a single text field.
In n8n (Node.js)
If you are using an n8n HTTP Request node and mapping variables into the body, you can use standard JavaScript inside the expression editor. Wrap your variable in JSON.stringify():
{{ JSON.stringify($json.custom_data_array) }}
If you need to inject this into a GraphQL query where the string itself needs to be wrapped in literal quotes, you can force the escape by calling it twice, or use our tool’s “Wrap in outer quotes” checkbox to see the exact syntax required.
Common Pitfalls When Passing JSON Through GraphQL APIs
GraphQL (used heavily by Shopify, Monday.com, and GitHub) is notorious for rejecting REST-style JSON payloads.
When executing a GraphQL mutation, your HTTP body usually requires two root keys: "query" and "variables". The content inside the "query" key must be a single line of escaped string text. If you try to paste a multi-line GraphQL query with standard quotes into a raw REST body, it will fail 100% of the time.
Always run your GraphQL queries through a stringifier tool before pasting them into your automation platform’s raw HTTP node.
Struggling with GraphQL mutations in your workflows? Stop fighting the documentation. Download our library of pre-configured Make.com and n8n blueprints for Shopify, GitHub, and Monday.com GraphQL endpoints.