JSON String Escaper — paste text, get a safe payload
Paste any message - with quotes, line breaks, emoji, backslashes or accented characters - and get back a correctly escaped JSON string: a safe payload you can drop into a request body. It sounds trivial until a multi-line message with an apostrophe in it produces a four-hundred error from the API and you spend twenty minutes staring at a curl command. Line breaks are the usual culprit: a real newline inside a JSON string is invalid, and shells, spreadsheets and copy-paste all insert them silently. Quotes are the second, especially when the text was copied from a document that uses curly quotes for some characters and straight quotes for others. Emoji are usually fine in modern stacks but still surprise older ones. Use this while you are building a request by hand or testing an endpoint from a terminal; in production, let your language's JSON serialiser do the escaping rather than building payloads with string concatenation, which is how injection bugs start.
Escaped string
As a message body
{"to": "+14155550100", "body": ""}The quotes around the value belong to the JSON; the escaped string goes between them, never with its own.
How it works
The rules JSON applies to a string are short but unforgiving. A double quote inside the value has to be preceded by a backslash, so does a backslash itself, and the control characters - newline, carriage return, tab and a handful of others - have to be written as two-character escapes because the raw bytes are not allowed inside a string at all. Everything else, including accented letters and emoji, may appear as itself in a UTF-8 document, or may be written as a Unicode escape when something in the chain cannot be trusted with the raw character. The tool shows the escaped text on its own and inside a ready-made message body, so you can see the difference between the string and the payload that carries it: the outer quotes belong to the JSON, not to your message.
Unescaping is the same operation run backwards, and it is on this page because the reverse case comes up just as often when you are reading. A webhook delivery, a log line or an error response shows a message body as an escaped string, with every line break written as a backslash and a letter, and you want to see what the person actually typed. Paste the escaped form, switch the direction, and the tool decodes it - or tells you where the string stops being valid, which is usually the moment a quote was left unescaped or a backslash was doubled by a second layer of tooling. That second layer is the classic cause of a body that looks escaped but still fails: a shell that escaped it once, then a template engine that escaped it again.
For anything that runs unattended, do not use this tool at all. Every language you might write a WhatsApp bot in has a JSON encoder that handles every case in the specification, and building a payload by joining strings is how a message containing a quote turns into a malformed request, or, in the worst case, into a field you never intended to send. The place for this page is the terminal: you are testing the text endpoint with a curl command, a no-code tool is asking you for raw JSON rather than a mapped field, or the API has just rejected a body and you want to see exactly which character it objected to. The send endpoint linked below shows the body shape the escaped string slots into.
Do it with the API
This tool is the browser-side version of one API call.
Frequently asked questions
Should I use this in my code?
No - use your language's JSON serialiser, which handles every case correctly and will not miss an edge. This tool is for the moment you are testing an endpoint by hand, debugging a payload that the API rejected, or pasting a message into a no-code tool that expects raw JSON rather than a mapped field.
Do emoji need escaping?
Usually not: modern JSON is UTF-8 and emoji pass through as themselves. Where it goes wrong is a toolchain that assumes a narrower encoding somewhere in the middle, in which case the escaped form is a safe fallback. The tool shows both so you can try the simple one first.
Why did my multi-line message fail?
Because a literal newline inside a JSON string is not valid JSON - it has to be escaped. That is the single most common cause of a validation error when people build a request by hand, and it is invisible in most editors. Paste the text here and use the escaped output instead.
Related
Try it on your own number
Create a channel, link a WhatsApp number by QR or pairing code, and call the API in a couple of minutes. The Sandbox plan is free and needs no card.