EditSafely

Tokenize JSON

Split a JSON data structure into its tokens. Runs entirely in your browser, so your data never leaves your device.

0 chars · 0 lines

Output

The result appears here as you type.

Options
Output

How to use Tokenize JSON

  1. 1. Paste your JSON. Put the JSON document you want broken down into the input pane. It gets scanned character by character the way a JSON lexer would, before any parsing happens.
  2. 2. Choose the Output format. Pick One per line for a readable, labeled listing of each token and its type, or JSON array to get the token list back as JSON itself for further processing.
  3. 3. Decide on whitespace tokens. Turn on Include whitespace tokens if you want spaces and newlines listed as their own entries, which matters when studying exactly how a lexer treats formatting characters.
  4. 4. Copy or review the token list. Copy the resulting list of punctuation, keys, numbers and literals, or read it directly on the page to see exactly how the document decomposes into its smallest pieces.

When to use Tokenize JSON

Tokenize JSON splits a JSON document into the individual tokens a lexer would produce, labeling each one as punctuation, a key, a number, a string or a literal. It is for anyone working at the level below parsing, where you need to see the raw pieces rather than the assembled tree.

  • Debugging a hand-written lexer. You are building a JSON parser from scratch and want a reference token stream to compare your own lexer's output against for a tricky input.
  • Teaching how JSON grammar works. You want to show a student exactly how a small object with a key and a nested array breaks down into brace, key, colon, bracket, number and literal tokens before it becomes a tree.
  • Verifying a syntax highlighter. A custom code editor highlights JSON by token type, and you want to confirm the token boundaries it detects match the actual lexical structure of a sample document.
  • Diagnosing a streaming parser failure. A streaming JSON parser chokes on a specific document and you want to see the token-by-token breakdown to find exactly where the stream is going wrong.

Examples

List the tokens of a document

Input

{"a": [1, true]}

Output

punctuation  {
key          "a"
punctuation  :
punctuation  [
number       1
punctuation  ,
literal      true
punctuation  ]
punctuation  }

About the Tokenize JSON tool

Tokenize JSON runs as plain JavaScript in your browser tab, with no server behind it. Split a JSON data structure into its tokens. Whatever you put in stays on your device from start to finish.

The tool is part of EditSafely's JSON Tools section, 90 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.

You can shape the output with 2 settings, including Output and Include whitespace tokens, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.

Frequently asked questions

Is Tokenize JSON free to use?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How much text can I process at once?

There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All JSON Tools