๐Ÿงฉ JSON Encoder/Decoder

Escape plain text into a JSON string literal (handling quotes and line breaks), or turn a JSON string back into its original text.

How to use

  1. Enter your text.
  2. Click "Text โ†’ JSON string" or the reverse button.
  3. Copy the result to use it.

๐ŸŽฏ Use Cases

Example

Input
Path: C:\logs\app.log
Status: "OK"
Output
"Path: C:\\logs\\app.log\nStatus: \"OK\""

Clicking "Text โ†’ JSON string" escapes each backslash as \\, each double quote as \", and the line break as \n, producing a single-line JSON string literal.

FAQ

How is this different from the JSON Formatter?
The JSON Formatter tidies or minifies an entire JSON object, while this tool escapes plain text into a single JSON string (or restores it back).
Does it handle text with line breaks?
Yes. They're automatically escaped as \n and converted into a single-line JSON string.
Is the text I enter sent to a server?
No. It's processed entirely in your browser using JSON.stringify/JSON.parse.

More Coding Tools

๐Ÿ“˜
JSON Formatter
Prettify, validate & minify JSON
๐Ÿ—“๏ธ
Timestamp Converter
Convert Unix timestamp โ†” date
โœจ
JS/CSS Formatter
Indent & tidy JS/CSS code
โœ‚๏ธ
JS/CSS Minifier
Strip comments & whitespace
๐Ÿงฝ
HTML Formatter
Indent HTML by tag structure
๐Ÿงน
XML Formatter
Indent XML by tag structure
๐Ÿ—ƒ๏ธ
SQL Formatter
Break SQL into clauses & indent
๐Ÿ”ฃ
HTML Entity Encoder
Convert special chars โ†” HTML entities
๐Ÿ“Š
Excel to HTML Table
Convert spreadsheet data to HTML TABLE
โ›“๏ธ
Link Extractor
Extract href/src links from HTML
๐ŸŽจ
Color Picker
Get HEX, RGB & HSL color codes
๐Ÿ˜
PHP Syntax Checker
Check bracket/string pairing (practical checker)
๐Ÿ—„๏ธ
MySQL Syntax Checker
Check bracket/quote pairing (practical checker)
๐Ÿ”
HTML5 Validator
Check tag pairing, duplicate id, missing alt
โœ๏ธ
Online HTML Editor
Write & edit HTML visually