JSON Escape / Unescape

Escape text for JSON strings or unescape JSON back to plain text, in your browser. Handles quotes, newlines, unicode. Free, instant.

Text inputpaste, type, or drop a file
Text output
Runs 100% in your browser. Nothing is uploaded, logged, or stored, and there are no ads. Verify it yourself: open your browser's Network tab while you convert and watch that no requests leave this page.

About this tool

Escape any text so it can sit inside a JSON string: quotes become \", newlines become \n, backslashes are doubled, and control characters get their unicode escapes. Switch the direction option to unescape and turn an escaped string back into readable text.

This is the tool for the classic multiline problem: certificates, SSH keys, SQL snippets, and error messages that need to live inside a JSON config value or an environment variable as one escaped line.

Common uses

  • Embed a multiline certificate or key in a JSON config value.
  • Unescape a stringified payload from a log line to read it.
  • Escape user-facing copy that contains quotes for a JSON fixture.

Automate via API

The same conversion is available as a REST endpoint for scripts, pipelines, and backends:

curl -X POST https://payloadly.com/api/v1/tools/json-escape \
  -H "Content-Type: text/plain" \
  -H "X-Api-Key: YOUR_API_KEY" \
  --data-binary @input.txt

API documentation · Get an API key

Worked examples

Real payloads from tools people use daily, with the exact output this converter produces. Every example runs in your browser, so you can load one and adapt it to your own data.

Escape a private key for a JSON env var

Multiline secrets must become a single escaped line before they can live in a JSON config or a one-line environment variable.

Text input
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIegvrYcWViKm0DZwkzo
-----END EC PRIVATE KEY-----
Text output
-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIIegvrYcWViKm0DZwkzo\n-----END EC PRIVATE KEY-----

Frequently asked questions

Is my data uploaded to a server?

No. This tool runs entirely in your browser using JavaScript, and there are no ads on the page. Nothing you paste or drop here is uploaded, logged, or stored, and you can verify that yourself: open your browser's developer tools and watch the Network tab while you convert (no requests leave the page), or disconnect from the internet after the page loads and keep working.

What exactly gets escaped?

The two characters JSON requires escaping (double quote and backslash), plus control characters using their short forms (\n, \t, \r, \b, \f) or \u00XX escapes. Forward slashes and non-ASCII text are left as-is; escaping them is legal but unnecessary.

Do I paste the surrounding quotes when unescaping?

Either way works. The unescape direction accepts the bare string body or the fully quoted form, so you can paste a value straight out of a JSON document, quotes and all.

Is there a size limit or a fee?

The browser tool is free with no signup and comfortably handles files up to tens of megabytes (limited by your device's memory). For automated or bulk processing inside your own scripts and pipelines, use the paid REST API.

Related tools