The Next JSON Toolbox

Nested JSON Parser

Paste JSON or open a .json file from your computer to view, format and decode nested JSON online.

Chars:0Tokens:0
No JSON data to display

JSON Tools

Array Tools

Text Tools

How to Use the Nested JSON Parser

Decode, format and view any JSON in three steps. Everything runs in your browser.

  1. 1Add your JSON. Paste it into the input box, click Open File to open a .json, .txt or extension-less file, or drag the file onto the box. Raw escaped strings copied straight from logs work too.
  2. 2Decode it. Valid JSON is formatted automatically. If it contains escaped strings like "{\"name\":\"John\"}", click Decode Nested JSON to unescape every level at once.
  3. 3Use the result. Expand or collapse nodes in the tree view, copy the formatted JSON, or use Convert to to download it as JSON, CSV, XML, YAML or Markdown.

Your data never leaves your browser. Nothing is uploaded or stored.

What Is Nested JSON?

Nested JSON (also called double-encoded or stringified JSON) is JSON that has been stored as a string inside another JSON document. Instead of a real object, you get one long string full of backslashes.

Nested (what you get)
{
  "event": "order",
  "payload": "{\"id\":42,\"items\":[\"apple\"]}"
}
Parsed (what you want)
{
  "event": "order",
  "payload": {
    "id": 42,
    "items": ["apple"]
  }
}

Each time JSON is serialized again, another layer of escaping is added: \" becomes \\\", and so on. After two or three rounds the data is almost unreadable.

Where nested JSON comes from

  • Logs: a logging library writes your JSON message into a message or log field of its own JSON line, as in Docker, Kubernetes and CloudWatch logs.
  • Message queues: an AWS SNS notification delivered to SQS wraps your payload twice, so the Message field inside Body is a string of a string.
  • Databases: JSON saved in a text column comes back from queries and exports as a plain string.
  • APIs and webhooks: some services stringify a field like data or metadata before sending it.

Why regular JSON formatters don't help

A standard parser such as JSON.parse or a typical online formatter decodes only one level. By the JSON spec, "{\"id\":42}" is a valid string, so the formatter keeps it as a string, still on one line with every backslash. Fixing it by hand means copying the string out, unescaping it, and repeating for each level, and a find-and-replace on \" breaks as soon as there is more than one level.

NextJSON finds every string that contains JSON and decodes it recursively, at any depth, in one click. It also accepts a whole escaped string pasted straight from a log, with or without its outer quotes.

How It Works

See how Next JSON effortlessly decodes multiple levels of encoded JSON strings with just one click. No more manual decoding

Nested JSON Example

Decode a JSON string containing escaped quotes and nested objects.

Input
{
  "user": "{\"name\":\"John\",\"age\":30}",
  "status": "active"
}
Output
{
  "user": {
    "name": "John",
    "age": 30
  },
  "status": "active"
}

Flat Multiple Level Encoding JSON

Flat deeply nested JSON strings with multiple levels of encoding.

Input
{
  "level1": "{\"level2\": \"{\\\"key\\\": \\\"value\\\"}\"}"
}
Output
{
  "level1": {
    "level2": {
      "key": "value"
    }
  }
}

Nested Array in JSON

Process arrays containing multiple encoded JSON strings.

Input
{
  "items": [
    "{\"id\":1,\"value\":\"first\"}",
    "{\"id\":2,\"value\":\"second\"}"
  ]
}
Output
{
  "items": [
    {
      "id": 1,
      "value": "first"
    },
    {
      "id": 2,
      "value": "second"
    }
  ]
}

Frequently Asked Questions

How to open a JSON file?

You can open a JSON file online right on this page, with nothing to install.

  1. 1Click Open File above the input box, or drag your file onto it.
  2. 2Pick any .json, .txt or extension-less file.
  3. 3NextJSON formats and validates it instantly, and decodes nested JSON strings.

The file is read in your browser and never uploaded.

Other ways to open a JSON file

  • Text editor: Notepad, VS Code, Sublime Text or TextEdit
  • Web browser: drag the file into Chrome or Firefox
  • Command line: cat file.json or jq . file.json

Why build this site?

While formatting JSON data from my log files, I found it tricky to decode the nested parts. So, I built this site to make my life easier! If it helps others too, that’s even better!

Does this site store my data in the cloud?

No, this site does not store or share your data in the cloud. Your data remains private and is kept locally on your broswer.

Why do I need to decode nested JSON strings?

Nested JSON strings often occur when JSON data is serialized multiple times, such as when storing JSON in databases or passing it through multiple systems. Decoding is necessary to access and work with the actual data structure rather than dealing with escaped string representations.

How does this JSON decoder handle multiple levels of encoding?

This tool automatically detects and recursively decodes JSON strings at any depth of nesting. It can handle scenarios where JSON has been encoded multiple times, carefully preserving the data structure while removing escape characters and converting string representations back into proper JSON objects.

Can this tool handle arrays of encoded JSON strings?

Yes, the decoder can process arrays containing multiple encoded JSON strings. It will iterate through array elements and decode any JSON strings it finds, maintaining the array structure while properly parsing each encoded element.

This site lacks some useful features that I need. Can you add them?

Yes, we welcome all suggestions! Please feel free to share your feedback using the link at the bottom of the page.