Prompt JSON Escaper
Escape a prompt for embedding in JSON or code, or reverse it.
Inputs
Direction
Output
Enter text to escape or unescape.
More in this kitAll of AI Companion Tools
About Prompt JSON Escaper
The Prompt JSON Escaper converts a multi-line prompt into a correctly escaped JSON string, ready to paste into an API request, a config file or source code. It also works in reverse, turning an escaped string back into readable text.
How to use it
- Choose a direction: Escape or Unescape.
- Paste your text.
- Copy the result.
Good to know
- Escaping wraps the text in double quotes and converts quotes, backslashes, line breaks and tabs into their JSON escape sequences.
- Unescape expects a complete JSON string, including its surrounding double quotes, and reports an error if the input is not one.
- Your text is processed in your browser. It is not sent to this site or to any AI provider.
Common questions
Why does my API request fail with a JSON error?
Unescaped quotes or raw line breaks inside a string break JSON. Escaping the prompt here fixes those characters.
Can I use the output in JavaScript or Python code?
Yes. A JSON string is also a valid string literal in JavaScript and, in most cases, in Python.