LocalUtils logo
LocalUtils
Files stay local for processing. Account, billing, and ads use separate network services. Learn more

Validate, format, minify, and scrub JSON deliberately

Readable JSON is not automatically valid for the job—or safe to share

Formatting helps humans inspect structure. A useful review continues beyond indentation to schema expectations, value meaning, persistence, and indirect identifiers.

Validate, format, minify, and scrub JSON deliberately

JSON is strict about quotes, commas, brackets, and value types. Formatting can make a document readable, while minification removes insignificant whitespace. Neither operation changes whether the data is sensitive.

The scrubber applies user-selected field-name rules after parsing valid JSON. It is a convenience for predictable structures, not a semantic privacy detector, and nested values can still reveal the same information under another key or inside free text.

Syntax validation is the first gate

A JSON parser checks quotes, commas, brackets, and supported value types. It does not know whether a date is possible, an identifier has the right length, or a required business field is missing.

Treat successful parsing as permission to inspect structure, not proof of correctness. Use a schema validator when the receiving system defines a schema.

Formatting and minification preserve meaning only within JSON rules

Indentation and insignificant whitespace can change without changing parsed values. Key order may be preserved by an implementation but should not be used as semantic meaning unless a separate protocol says otherwise.

Numbers can also be a concern. JavaScript represents ordinary JSON numbers with IEEE-754 behavior, so very large integers can lose exactness in downstream processing.

Scrub values, not only familiar labels

A key rule can remove email or token fields when names are predictable. The same value may remain under another key, inside a log message, in a URL, or encoded within a nested string.

After scrubbing, search for the original values and inspect arrays and deeply nested objects. Anonymization requires a broader data-risk analysis than deleting a few properties.

Remember local persistence and clipboard history

The formatter stores current input and preferences in localStorage. On a shared profile, another user can reopen that state until it is cleared.

Copying output may place it in operating-system or clipboard-manager history. Clear the tool, avoid real secrets in demonstrations, and use purpose-built secret handling for credentials.

Define the sharing threat before choosing scrub rules

A useful scrub begins with the recipient and the reason for sharing. Support staff may need an error code and timestamp but not an access token, customer email, internal host name, or full request body. Write down the fields that are required, fields that must be removed, and values that need partial masking. Run the scrubber, then search for both known keys and recognizable sample values. Remember that identifiers can appear inside free text, arrays, encoded strings, or unfamiliar property names. When the stakes are high, create a minimal JSON example by hand instead of sending a reduced production record.

Quick start: LocalUtils

  1. Paste or type a copy of the JSON and validate it before making assumptions about the structure.
  2. Use formatting for review and minification only when a compact representation is actually required.
  3. Configure scrub rules for exact field names used in the document, then inspect every replacement in context.
  4. Copy or download the result and validate it again in the destination system.

What the browser does

The browser parses the input with JavaScript JSON handling, recursively applies configured key rules, and serializes the result with or without indentation.

Current input and scrub preferences are stored in localStorage for convenience. That persistence is useful on a personal device but inappropriate for confidential data on a shared browser profile.

Inputs and outputs

  • Input: one valid JSON value, including an object, array, string, number, boolean, or null.
  • Output: formatted, minified, or scrubbed JSON text.
  • Comments, trailing commas, NaN, Infinity, and JavaScript object syntax are not standard JSON.

Limits to know before you start

  • A valid document can still have the wrong schema or misleading values.
  • Key-based scrubbing misses secrets stored under unexpected names or embedded in text.
  • Large pasted documents can make the editor and browser storage slow.
  • Formatting does not encrypt, anonymize, or validate business rules.

Verification checklist

  • Parse the final output in a second JSON parser.
  • Search for every original sensitive value, not only the expected key name.
  • Compare counts and required fields with the source schema before using the result.

Troubleshooting

  • Use the reported position near a parse error and inspect the preceding comma, quote, or bracket.
  • If a rule changes too much, narrow the field-name match and rerun from the original.
  • If the editor becomes slow, use a file-oriented or streaming workflow rather than pasting multi-megabyte data.

Questions people ask

Why does valid JSON still fail in my API?

The API may require a specific schema, encoding, size, authentication context, or field semantics beyond JSON syntax.

Can formatting change a huge integer?

Parsing through JavaScript number values can lose precision outside the safe integer range. Store such identifiers as strings when the schema permits.

Does deleting a name anonymize a record?

Not necessarily. Other fields and combinations can identify the same person, and external datasets can enable re-identification.