JSON ↔ String Converter
Convert JSON to escaped strings for embedding in code, or unescape string litera...Convert JSON to escaped strings for embedding in code, or unescape string literals back to readable JSON. Handles multi-level escaping, JS objects, an...
Converter Features
Why Use JSON ↔ String Converter?
Two-Way Conversion
Convert JSON to escaped strings for embedding, or decode escaped string literals back into readable JSON.
Auto-Detect Direction
Paste anything and the tool figures out whether you meant to escape or unescape — toggle Auto/Manual anytime.
Multi-Level Unescape
Handles double- and triple-escaped strings from logs, DB dumps, or nested API payloads automatically.
Multiple Quote Styles
Output as double-quoted, single-quoted, template literal, or raw escaped content — match your target language.
100% Client-Side
Everything runs in your browser. Your JSON never hits a server.
Instant Preview
Live conversion as you type, with byte and character counters on both sides.
Common Uses
Embedding JSON in Code
Turn a config object into a single-line escaped string ready to paste into JS, Python, or Go source.
Reading Log Output
Unescape JSON pulled from log lines, CloudWatch events, or console.log output.
DB Field Debugging
Decode JSON stored as an escaped string column so you can actually read it.
HTTP & CLI Payloads
Encode JSON for curl --data, HTTP headers, or CI environment variables with the right quote style.
How It Works
Paste JSON or Escaped String
Drop in a JSON object to escape, or an escaped string literal (with or without outer quotes) to decode.
Pick Direction & Format
Auto-detect works for most cases. Switch quote styles (double, single, backtick, raw) for encode, or indent size for decode.
Copy the Result
Output updates live. Use Copy for one-click clipboard, or Swap to round-trip the result back through the tool.
Tips & Best Practices
Use Auto Mode First
Leave direction on Auto — the detector reads the shape of your input and picks the right side. Override only when it guesses wrong.
Pick Quotes for Your Target
Embedding in a JS template literal? Pick backtick. Python f-string? Single. Curl with --data? Double. Raw gives you escaped content without outer quotes.
Swap to Round-Trip
After converting, click Swap to feed the output back through. Lets you sanity-check that encode + decode produce your original JSON.