Text utilities

JSON String Escape and Unescape

Encode plain text as one valid JSON string, or decode a quoted JSON string back into text.

Text stays in your browserCopy your result
Data workspace
Data workspace

Check delimiters and structure before downloading the output.

See the method

Your source data

Runs on your device

Your transformed data

Your result

Let’s calculate.

Use the Calculate button to see your result.

Your content is processed locally.

How to use this tool

  1. Enter text or quoted json string, action.
  2. Select Update result to view the result.
  3. Check the method and assumptions below before using the result.

Input reference and sample values

Use the units and choices shown for each field. Sample values are provided for practice, not as recommendations.

InputFormat and unitsSample
Text or quoted JSON stringKeep the structure and separators shown in the sample. Line breaks are retained in this input.Hello "world" Second line
ActionChoose Escape as JSON string / Unescape JSON string.Escape as JSON string

Result for these sample inputs

"Hello \"world\"\nSecond line"

Select Try the example in the form to load these values and calculate them again. This replaces the current form inputs. Compare the result with the method and worked explanation below.

The method, explained

Encoding applies JSON.stringify to the entire input string. Decoding applies JSON.parse and accepts only a string value, rejecting objects, arrays and numbers.

A WORKED EXAMPLE

Using text or quoted json string = Hello "world" Second line, action = encode, the result is "Hello \"world\"\nSecond line". Change these example inputs to match your task; use the method above to check each step.

What to keep in mind

This is JSON string escaping, not HTML escaping. Empty decoded strings are valid results.

Common questions

How is this different from JSON formatting?

A formatter works on a complete JSON document. This tool handles one string value and its quotes, newlines, backslashes and escape sequences.

Does my text leave my device?

Processing runs locally in this browser. Your pasted text is not uploaded to an API or stored in a ClarityKit account.

Methodology maintained by ClarityKit. How these tools are built and checked.