JSON Escape / Unescape
Escape text for JSON strings or unescape JSON back to plain text, in your browser. Handles quotes, newlines, unicode. Free, instant.
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
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.
-----BEGIN EC PRIVATE KEY----- MHcCAQEEIIegvrYcWViKm0DZwkzo -----END EC PRIVATE KEY-----
-----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
Convert text case in your browser: uppercase, lowercase, title, sentence, camelCase, snake_case, kebab-case, and more. Free, instant.
Generate cron expressions from plain English or decode one into a schedule with its next 5 run times. Runs in your browser, free.
Generate Discord timestamp codes from any date. All 7 <t:unix:style> formats with previews; every reader sees their own timezone.
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes of text in your browser. Nothing leaves the page; ideal for checksums. Free, instant.