What is JSON Stringify?
JSON Stringify converts a JSON object or array into a single escaped string literal, exactly what JavaScript's JSON.stringify() produces when you pass it a JSON text. Quotes become \", line breaks become \n, and the result is wrapped in double quotes, so it can be pasted into source code, an environment variable, a database column, or an API field that expects a string rather than an object.
It also works in reverse. Parse mode takes a stringified value such as "{\"name\":\"Ada\"}" and turns it back into readable, formatted JSON. It accepts strings with or without their surrounding quotes, and it unwraps JSON that was stringified more than once, which is common in logs and message queues.
How to use JSON Stringify
- Choose Stringify to turn JSON into an escaped string, or Parse to turn a stringified string back into JSON.
- Paste your input into the left panel. The result appears instantly on the right.
- Use the Compact / Indent button to choose whether the JSON is kept on one line or indented with 2 or 4 spaces.
- Copy the result, or download it as a file.
Key features
- Stringify JSON into an escaped string literal, the same as JSON.stringify()
- Parse stringified JSON back into formatted, readable JSON
- Unwraps double- and triple-stringified JSON automatically
- Accepts escaped JSON copied without its outer quotes, e.g. from logs
- Compact, 2-space or 4-space output
- Keeps large integer IDs exact (no floating-point rounding)
- 100% client-side: private and works offline
Common use cases
- Embedding a JSON payload as a string in JavaScript, Python, Java or Go source code
- Storing JSON in an environment variable, config value or database text column
- Sending a JSON object inside a string field of another API request or message
- Reading escaped JSON from server logs, Kafka/SQS messages or webhook payloads
- Debugging double-encoded JSON returned by APIs and serverless functions
Technical details & standards
Stringify mode first checks that the input is valid JSON (RFC 8259), re-serializes it compactly or with the chosen indentation, then escapes it as a JSON string: the same output as JSON.stringify(JSON.stringify(value)) in JavaScript. Input that is not valid JSON is escaped as plain text instead, and the tool says so.
Parse mode decodes the string with standard JSON string rules and keeps decoding while the result is itself a string, so double- and triple-stringified payloads come out as JSON in one step. Numbers are carried through as their original digits rather than converted to floating point, so 64-bit IDs such as 9007199254740993 are never rounded. Everything runs locally in your browser; nothing is uploaded.
JSON to string and back in JavaScript and Python
Stringifying JSON twice is what turns an object into an escaped string you can embed inside other JSON, an environment variable or a test fixture. Parsing twice reverses it.
JavaScript
const obj = { name: "Ada", tags: ["math", "code"] };
const str = JSON.stringify(JSON.stringify(obj));
// "{\"name\":\"Ada\",\"tags\":[\"math\",\"code\"]}"
JSON.parse(JSON.parse(str)).tags[1]; // "code"Python
import json
obj = {"name": "Ada", "tags": ["math", "code"]}
s = json.dumps(json.dumps(obj, separators=(",", ":")))
# '"{\\"name\\":\\"Ada\\",\\"tags\\":[\\"math\\",\\"code\\"]}"'
json.loads(json.loads(s))["tags"][1] # 'code'separators=(",", ":") removes the spaces Python adds by default, so the output matches JSON.stringify.
Convert a JSON object to an escaped string
Some APIs store an entire JSON document inside a string field. Stringifying adds the quotes and escapes required for that extra layer; parsing removes one layer again.
Example input
{"name":"Ada"}- Paste the JSON object and choose Stringify to produce a quoted JSON string.
- Check that the inner property and value quotes are escaped with backslashes. These backslashes belong to the string encoding, rather than to the original name.
- Use Parse on the quoted output to recover the object. Avoid repeatedly stringifying an already escaped value, which adds another encoding layer.
Expected result
"{\"name\":\"Ada\"}"Continue with a related task:
Frequently asked questions
What does JSON.stringify do?
JSON.stringify converts a JavaScript value into JSON text. Calling it on JSON text (or calling it twice on an object) produces a string literal: the JSON is wrapped in double quotes and its inner quotes, backslashes and line breaks are escaped. This tool produces that result without writing any code.
How do I convert a stringified JSON string back to JSON?
Switch to Parse mode and paste the string. The tool removes the escaping (the same as JSON.parse) and formats the JSON. If the value was stringified more than once, every level is unwrapped automatically.
What is the difference between JSON Stringify and JSON Escaper?
JSON Escaper escapes any text for use inside an existing JSON string and does not add surrounding quotes. JSON Stringify validates that the input is JSON, can compact or indent it, wraps the result in quotes, and can also parse stringified JSON back into objects.
Why does my stringified JSON have backslashes everywhere?
A JSON string cannot contain a bare double quote, so every quote inside the stringified JSON is written as \". The backslashes disappear when the string is parsed again with JSON.parse, or with Parse mode here.
Will large numbers lose precision?
No. Numbers keep their exact original digits in both directions, unlike a JSON.parse round trip in JavaScript, which rounds integers larger than 9007199254740991.
How do I escape or unescape a JSON string online?
Use Stringify mode to escape: quotes become \", line breaks become \n and the whole value is wrapped in quotes. Use Parse mode to unescape a string such as "{\"id\":1}" back into formatted JSON. If you only need to escape a fragment of text rather than a whole JSON value, the JSON Escaper does that.
Is my data safe?
Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.
Does it work offline?
Once the page has loaded, this tool can process input without an internet connection.