Calculator
What the JSON Escape does
JSON Escape: calculates JSON-escaped from Text. Example: the sample loaded on the page gives JSON-escaped He said \"hi\"\nNew line\tTab.
Point it at Text and it returns JSON-escaped. Results refresh instantly, so trying variations costs nothing but a moment.
Doing this by hand is tedious and error-prone once the text runs past a few lines. That is usually what brings people preparing copy for publishing here.
Because it is all local, the tool is as fast as your device and as private as your own notes.
The sections that follow cover the fields, the method, and one full example computed from the defaults.
What do the JSON Escape fields mean?
The JSON Escape uses 1 input. Every field is populated on load; treat those numbers as a template rather than a suggestion.
| Field | What to enter | Default |
|---|---|---|
| Text | paste or type any amount of text | He said "hi" New line Tab |
How does the JSON Escape work?
Each output is derived from the inputs above in a single pass; there is no hidden state carried between runs, so the same inputs always give the same calculation.
The guard clauses run before the formula does, which is why mistakes surface next to the field.
Worked example
These are the values the JSON Escape loads by default, and the result it produces from them. This walkthrough uses the starting values, which means you can follow along without typing anything.
| Text | He said "hi" New line Tab |
|---|
| JSON-escaped | He said \"hi\"\nNew line\tTab |
|---|
How to use it
- Paste your content into Text.
- Each keystroke triggers a fresh calculation, which is cheap because it happens locally.
- You get JSON-escaped back.
- Share the link rather than a screenshot. It carries the values with it.
What this tool does not do
- Very large pastes are limited by your browser memory rather than a server quota.
- Word and character definitions vary between tools: this one counts whitespace-separated tokens.
- Nothing is saved between visits, so keep your own record of anything you need again.
Frequently asked questions
Text. That is the whole form. Each field is pre-filled with a sensible default, which means a single edit is enough to get a meaningful answer.
With the values loaded when the page opens, JSON-escaped comes out as He said \"hi\"\nNew line\tTab. Change a value and the number is recomputed on the spot.
It never leaves the tab. The page does the work itself rather than asking a server to.
It is free to use, with no premium tier holding back the useful parts.
Reliable for the case described. Where more than one convention exists, the method section says which one is used.