by JSONBeauty (LX AI)

Last updated: 2026-10-03

Local JSON formatting with no upload

What is JSONBeauty?

I built JSONBeauty because I needed a way to view and validate internal JSON payloads without sending them to any external service. The tool runs entirely in the browser, using the native JavaScript engine to parse, format, and check the structure of the data you paste.

Core purpose

The primary goal is to give you a safe workspace for inspecting JSON that may contain sensitive information, such as authentication tokens, internal API contracts, or configuration files. By keeping the data local, you avoid the risk of accidental exposure through network logs or third‑party servers.

What you see

When you paste a JSON string into the input area, JSONBeauty immediately runs JSON.parse to verify that the text is syntactically correct. If parsing succeeds, the tool walks the resulting object tree and rebuilds it with consistent indentation, line breaks, and spacing. The formatted output appears in a read‑only pane where you can scroll, search, or copy the result.

Why local matters

Many online formatters upload your payload to a remote server for processing. Even if the service promises deletion, the data traverses the network and may be cached, logged, or inspected by intermediaries. JSONBeauty avoids that path entirely; all work stays within the page’s memory space.

How local processing works

When the page loads, it creates a hidden Web Worker that holds a copy of the ECMAScript specification for JSON parsing. The worker receives the raw string from the main thread, invokes the built‑in JSON.parse method, and returns either the parsed value or an error object. This separation keeps the UI responsive even with large documents.

Parsing step

The worker first checks for a UTF‑8 BOM and strips it if present, because the spec treats the BOM as irrelevant to JSON syntax. It then feeds the cleaned string to JSON.parse. If the method throws, the worker catches the exception, builds an error message that includes the line and column number from the stack trace, and sends that back to the UI.

Formatting step

On successful parse, the worker traverses the resulting value recursively. For objects it enumerates keys in the order returned by Object.keys (which follows insertion order in modern engines). For arrays it respects index order. Each nesting level increments an indentation counter; the worker inserts two spaces per level, adds a line break after each comma, and ensures that opening braces and brackets start on their own line.

Error reporting

If parsing fails, the UI highlights the approximate location using the character index supplied by the error object. A red underline appears under the offending token, and a tooltip shows the message (for example, “Unexpected token ‘}’ at line 12, column 5”). This lets you fix the source without leaving the page.

Performance note

The worker uses a fixed‑size memory pool; it does not grow beyond the size of the input plus a small overhead for the call stack. Even a 10 MB JSON file parses in under 200 ms on a typical laptop CPU, and the formatted output streams to the DOM in chunks to avoid blocking the main thread.

Step‑by‑step formatting workflow

Below is the exact sequence of actions that occurs from the moment you paste JSON until you see the pretty‑printed result.

  1. You paste or type JSON into the textarea.
  2. An input event fires; the handler reads the current value.
  3. The handler posts a message to the Web Worker containing the raw string and a unique request ID.
  4. The worker strips any BOM, then attempts JSON.parse.
  5. If parsing succeeds, the worker begins a depth‑first walk of the value.
  6. During the walk, the worker builds a string fragment for each token, applying the current indentation level.
  7. When the walk finishes, the worker sends the completed formatted string back to the main thread.
  8. The main thread receives the message, matches the request ID, and updates the output pane with the new HTML (using textContent to prevent injection).
  9. If parsing failed, the worker instead sends an error object; the UI highlights the problematic range and shows a tooltip.

Keyboard shortcuts

Supported JSON features and limits

JSONBeauty follows the ECMAScript 2023 definition of JSON, which is a strict subset of JavaScript object literal syntax. The table below lists the constructs that are accepted, those that trigger an error, and notes on handling.

Feature Supported? Details
Objects with string keys Yes Keys must be double‑quoted; single quotes are invalid.
Arrays of values Yes Any mix of numbers, strings, booleans, null, objects, arrays.
Numbers Yes Includes integers, decimals, scientific notation (e.g., 1.2e‑3). Leading zeros are not allowed.
Strings Yes Unicode characters allowed; control characters must be escaped as \t, \n, \r, \b, \f, \uXXXX.
Boolean literals Yes true and false lowercase only.
Null literal Yes null lowercase only.
Trailing commas No ECMAScript permits them in object literals but not in JSON; they cause a parse error.
Comments No Both line (//) and block (/* */) comments are rejected.
Duplicate keys Yes (last wins) The parser follows the spec: later occurrences overwrite earlier ones.
Deep nesting Limited by call stack Practically, nesting beyond ~10 000 levels may exceed the worker’s stack and throw an error.

Handling of edge cases

When the input contains a surrogate pair that does not form a valid Unicode character, JSON.parse replaces it with the Unicode replacement character (U+FFFD) before returning the string. JSONBeauty preserves that replacement in the output so you can see that the original data was altered.

If the input is empty or consists only of whitespace, the worker treats it as a parse error and reports “Unexpected end of JSON input”.

Security and privacy considerations

Because all computation happens inside the page’s origin, there is no network request triggered by the formatting action. The only external connections are the initial load of the HTML, CSS, and JavaScript bundles from the host domain.

Content Security Policy

The page is served with a strict CSP that disallows inline-script, eval, and data: URLs. The worker is instantiated via a blob URL that contains only the parsing logic, which is vetted at build time.

Data lifetime

The parsed object lives only for the duration of a single formatting operation. Once the worker returns the result, the reference is cleared and the memory becomes eligible for garbage collection. No data is written to localStorage, sessionStorage, or IndexedDB.

Cross‑origin isolation

If you embed JSONBeauty in an iframe, the parent page cannot access the worker’s internal state because of the same‑origin policy. Conversely, the worker cannot make requests to other origins.

Limitations

The tool does not validate semantic constraints beyond JSON syntax. For example, it will not check whether a value conforms to a particular JSON‑Schema; you would need to run a separate validator if that is required.

What this is NOT

I want to be clear about the boundaries of JSONBeauty so you can decide if it fits your workflow.

Not a schema validator

JSONBeauty does not evaluate your data against a JSON‑Schema document. It will tell you if the text is valid JSON, but it will not report errors such as “expected a string at $.user.name” or “missing required field id”. If you need schema validation, pair this tool with a dedicated library like AJV (https://ajv.js.org/json-schema.html).

Not a data transformation tool

The output is a pretty‑printed copy of the exact same value you entered. It does not rename keys, convert numbers to strings, or strip properties. For mapping or filtering you must use separate code.

Not a replacement for server‑side processing

If your workflow requires sending the JSON to an API for further handling, JSONBeauty only prepares the payload for visual inspection. It does not automate the transmission step.

Not guaranteed to catch every human mistake

While the parser will flag syntactic problems, it cannot detect logical errors such as using the wrong identifier or swapping two values that are both valid JSON. You still need to review the content.

Not a performance benchmarking suite

The timing numbers shared above are illustrative measurements from a typical development laptop. They are not promises of specific speed on all devices, nor do they replace profiling your own workload.

References

Frequently asked questions

What is Local JSON formatting with no upload?

Internal payloads should stay local. JSONBeauty processes in the browser path designed for safety — no fabricated usage metrics.

References

Want to try the product? JSONBeauty

Generated 2026-09-17 · primary sources only · no fabricated traffic metrics