JSON Escape and Unescape
Turn a JSON document into a string you can paste inside another document, or read an escaped string back into the text it stands for.
关于此工具
Escaping is what a document needs before it can live inside a string: a JSON value holding another JSON document, a log line, a shell argument, a fixture pasted into a test. The rules are short and all of them are here. The characters with a short escape get it, control characters that have no short form become a \u escape, and a forward slash is left alone, because JSON accepts \/ and nothing requires it. Optionally everything above ASCII becomes a \u escape as well, which is what you want when the text has to cross something that is not certainly UTF-8. Neither direction requires valid JSON, since escaping part of a document is an ordinary thing to want, and the page says separately whether the result happens to parse.
使用方法
- Choose Escape or Unescape, then paste your text into the left pane.
- When escaping, decide whether to wrap the result in quotes and whether to escape everything above ASCII.
- Press Convert, then copy the result. A bad escape is reported with the line and column it sits on.