Handle quotes, backslashes, controls, newlines, and Unicode with the browser's strict JSON string rules rather than ad-hoc replacements.
Your data stays in this browser
Text or JSON string literalTEXT
UTF-8Ln 1, Col 1
ResultJSON
UTF-8—
Loading…
Browser-only autosaveInputs and settings stay saved only in this browser and return after a reload. Turn on Clear saved data to keep this tool session-only.
Your data stays in this browser
InstantNo server round trips
PrivateBrowser-side processing
AuditableDocumented semantics
PortableCorrectly typed downloads
Category
JSON String Escape / Unescape: How to use this tool
Encode arbitrary text as one complete quoted JSON string literal, or strictly decode a JSON string literal back to exact text.
Handle quotes, backslashes, controls, newlines, and Unicode with the browser's strict JSON string rules rather than ad-hoc replacements.
Open guide and examples
How to use this tool
Enter arbitrary text to encode. To decode, enter one complete quoted JSON string literal and choose Decode JSON string in Advanced mode.
Run Escape as JSON string, or open Advanced and run Decode JSON string for one quoted literal.
Review the result, then copy it or download it with the correct file type.
Example to try
Text or JSON string literal
Line one
"quoted text" and \backslash
Result
"Line one\n\"quoted text\" and \\backslash"
Learn
Frequently asked questions
Does this tool upload my text?
No. String encoding and decoding run entirely in your browser. URL import contacts only the address you explicitly enter.
What can Decode JSON string accept?
It accepts exactly one valid quoted JSON string literal. Objects, arrays, numbers, booleans, null, unquoted text, and trailing content are rejected.
What does JSON String Escape / Unescape produce?
Escape returns valid quoted JSON; Decode returns plain text only when the entire input parses to a JSON string value.
What limitation applies to JSON String Escape / Unescape?
JSON string escaping is not HTML sanitization and does not make text safe for direct insertion into HTML or script markup.