How to use
- Enter your text.
- Click "Text โ JSON string" or the reverse button.
- Copy the result to use it.
๐ฏ Use Cases
- Safely embed text containing quotes or line breaks as a JSON value
- Escape a string to place inside an API request body
- Decode a JSON string literal
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