Menu

JSON Obfuscator - Reversible Key & Value Obfuscation

Real parser. Reversible obfuscation. Rename keys and encode string values with a downloadable mapping file that restores the original exactly.

JSON Obfuscation Studio Reversible
Ready
JSON Source 0 lines • 0 chars
Obfuscated Output 0 lines • 0 chars
Minify mode. Only whitespace is removed. All keys and values are preserved. Enable 🔒 or 🔑 above to actually obfuscate.
Complete Guide to JSON Obfuscation

What JSON Obfuscation Actually Means

JSON is the lingua franca of modern APIs, configuration files, mobile app data, and browser storage. It is designed to be human-readable and machine-parseable. That readability is a strength during development — and a liability when you ship a JSON file to a client who should not see its internal structure or values.

Unlike JavaScript, which can be obfuscated into unrecognizable control flow, JSON has no control flow. It is a data format. That means JSON obfuscation can only do two things:

  • Rename keys — replace meaningful key names like api_key with opaque identifiers like k_a7x9d2.
  • Encode string values — replace readable strings like "nginx:latest" with Base64-encoded values.

Both transformations are reversible only if you keep a mapping. Without the mapping, the resulting JSON is not usable by the original consumer. This tool always generates a mapping file alongside the obfuscated output so nothing is lost.

Why This Tool Parses JSON Before Transforming

Many "JSON obfuscators" use regex to find keys and values, then transform them. This approach corrupts JSON in subtle ways:

  • A string like "https://api.example.com/v1/users" contains characters that a naive regex will misidentify as keys.
  • A number like 5432 in a config might be transformed to a string, breaking the consumer's type expectations.
  • Escaped characters inside strings (\", \\, \n) get mangled when the regex replaces content.

This tool takes a parse-first approach. It reads the JSON using a real recursive-descent parser that produces a tree. Only then does it apply transformations — on the tree, not on text. The tree is then serialized back to JSON with the same escaping rules the input used.

The result: no value is ever corrupted. A URL stays a URL. A port number stays a number. An escaped quote stays escaped. A nested array stays nested.

What This Tool Preserves

JSON ConstructPreserved?
Numbers (integers, floats, negative, scientific)✅ Never encoded
Booleans (true, false)✅ Never encoded
Null (null)✅ Never encoded
Nested objects and arrays✅ Structure preserved at all depths
Escaped characters in strings✅ Correct escaping preserved
Unicode content✅ Encoded and decoded as UTF-8
Key order✅ Preserved (insertion order)
String keysRenamed when option enabled (reversible)
String valuesEncoded when option enabled (reversible)

Modes — Minify, Obfuscate Values, Rename Keys, Deep Obfuscate

ModeWhat ChangesReversible?Safe for APIs?
MinifyWhitespace and indentation removedN/A✅ Yes
🔒 Obfuscate ValuesString values Base64-encoded✅ Mapping❌ No — consumer expects plain text
🔑 Rename KeysKeys replaced with random IDs✅ Mapping❌ No — consumer expects specific keys
🎭 Deep ObfuscateBoth keys and values, at every nesting level✅ Mapping❌ No

Example — Simple JSON

Input:

{"name": "Ahmed", "age": 30}

Obfuscated (🔒 ON, 🔑 ON):

{"k_a7x9d2": "QWhtZWQ=", "k_b3c4e1": 30}

Mapping:

[Keys]
k_a7x9d2 => name
k_b3c4e1 => age

[Values]
QWhtZWQ= => "Ahmed"

Decoded:

{"name": "Ahmed", "age": 30}

Notice: age stayed a number (30), not a string. The tool never converts types.

Example — Nested API Response

Input:

{
  "user": {
    "id": 1001,
    "name": "John Doe",
    "roles": ["admin", "editor"],
    "active": true
  },
  "endpoint": "https://api.example.com/v2"
}

Obfuscated:

{"k_a1": {"k_b1": 1001, "k_b2": "Sm9obiBEb2U=", "k_b3": ["YWRtaW4=", "ZWRpdG9y"], "k_b4": true}, "k_a2": "aHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vdjI="}

Every key renamed, every string value Base64-encoded, but 1001 stays a number, true stays a boolean, and the array structure is intact.

Reversibility — How the Mapping Works

When obfuscation is enabled, the tool generates a mapping file with two sections:

  • [Keys] — obfuscated => original for every key that was renamed.
  • [Values] — encoded => original for every string value that was encoded.

To decode, apply the mapping in reverse. The "Test Decode" button in this tool does exactly that: it takes the obfuscated output, applies the mapping, and verifies that the resulting JSON structurally matches the original. If it matches, you see "Decode round-trip PASSED."

The mapping file is the key to the obfuscation. Keep it private. Do not ship it with the obfuscated JSON.

What JSON Obfuscation Cannot Do

  • It cannot hide data from a determined reader. Base64 is not encryption. Anyone with the obfuscated JSON can decode values in seconds.
  • It cannot make obfuscated JSON work with unmodified consumers. A REST API client expects specific keys. Renamed keys will not be recognized.
  • It cannot protect secrets. If your JSON contains API keys, database passwords, or tokens, do not ship it to the client at all. Obfuscation is not a substitute for server-side secrets management.

When to Use JSON Obfuscation

  • Shipping JSON config files to clients — you control the loader, so you can apply the mapping before reading.
  • Reducing readability of sample API responses in documentation, to prevent copy-paste into production.
  • Protecting field names in proprietary data formats where you own both ends.
  • Preventing casual scraping of structured data served as JSON files.

When NOT to Use JSON Obfuscation

  • Public REST APIs — clients expect documented keys. Renaming breaks every client.
  • Config files consumed by standard tools — package.json, tsconfig.json, composer.json, and similar files require specific keys.
  • Storage formats used by SDKs — Firebase, AWS, and similar tools parse JSON with fixed schemas.
  • Anywhere the file must be re-read by code you do not control. If the reader is outside your codebase, obfuscation breaks it.

JSON vs YAML vs XML — Why the Approach Differs

All three are structured data formats, but the obfuscation strategy differs:

  • JSON has explicit types (numbers, strings, booleans, null) and a strict grammar. Parsers are easy to write. This tool uses a recursive-descent parser that never confuses a number with a string.
  • YAML is more permissive — strings can be unquoted, numbers can look like strings, and multi-line values exist. YAML obfuscation must handle more edge cases.
  • XML has attributes, CDATA sections, namespaces, and processing instructions. Its obfuscation preserves all of these.

The common thread: all three must be parsed before transformation, because text-level transformation corrupts them.

Security Considerations

Base64 is not encryption. It is a reversible encoding used for transport, not for security. Anyone with the obfuscated JSON and a Base64 decoder can recover the original values. This tool is honest about what it does: it makes the JSON harder to read at a glance, and it gives you a reversible mapping. It does not hide secrets.

If you need to protect sensitive JSON data:

  • Encrypt the file with age, gpg, or AES-GCM. Decryption requires a key the client does not have.
  • Keep it server-side. If the JSON never leaves your server, it cannot be read from the client.
  • Use signed JWTs for authentication tokens where integrity matters more than readability.
  • Store secrets in a secrets manager (HashiCorp Vault, AWS Secrets Manager) rather than in files.

Integrating JSON Obfuscation Into Your Build

For teams that ship obfuscated JSON regularly, the workflow is:

  1. Obfuscate the JSON in this tool with the desired options.
  2. Download the obfuscated JSON and the mapping file.
  3. Ship the obfuscated JSON to the client.
  4. Keep the mapping file in your private build system or secrets store.
  5. At load time, apply the mapping in your client code to restore original keys and values.

Because the mapping is deterministic, you can bake the reverse transformation into your client loader once, and every obfuscated JSON file your build produces will decode correctly. Only the mapping file needs to travel with each release.

Frequently Asked Questions

Does this tool corrupt URLs, ports, or numbers?
No. The parser distinguishes between string values, numbers, booleans, and nulls. Only string values are encoded (and only when the option is enabled). Numbers stay numbers, booleans stay booleans, and URLs stay intact as strings until encoded — and even then they can be decoded exactly back to the original URL.
Is Base64 encryption?
No. Base64 is a reversible encoding for transport. Anyone with the obfuscated value can decode it in seconds. This tool uses Base64 for structural preservation (no escaping issues), not for security.
Will obfuscated JSON work with my API?
Only if your API client is designed to read the obfuscated keys and decode the values. A standard REST client expects the original keys. Renamed keys are not recognized. Use this tool only when you control both the producer and the consumer.
How does the decode round-trip test work?
After obfuscation, the tool re-parses the output, applies the mapping in reverse, and compares the structural fingerprint (key count, array count, nesting depth) to the original. If they match, the "Decode round-trip PASSED" message appears.
Is my JSON uploaded to your server?
No. Everything runs in your browser using JavaScript. Your JSON never leaves your device.
Can I use this for commercial projects?
Yes. Obfuscate any JSON you own or have rights to modify.
What is the maximum file size?
There is no hard limit, but files above 5 MB may cause noticeable slowdowns in the browser. For very large JSON, use a native tool like jq or json-cli on the command line.
Does it handle deeply nested JSON?
Yes. The parser is recursive and handles nesting at any depth. There is a practical limit around 200 levels deep, beyond which browser stack limits apply.
What happens to duplicate keys?
JSON technically allows duplicate keys but the behavior is undefined. This tool preserves them in order and renames them independently. The mapping file will contain separate entries for each duplicate.
Is key order preserved?
Yes. The parser records keys in insertion order and the serializer re-emits them in the same order. This matters for JSON files that are diffed in version control.
Does it work with JSON5 or JSONC (JSON with comments)?
No. This tool accepts strict JSON only. Comments in JSONC are not part of the JSON spec and the parser rejects them. For JSON5 or JSONC, convert to strict JSON first.
What about very long strings?
String length is limited only by browser memory. Base64 encoding increases length by roughly 33%, so a 1 MB string becomes about 1.33 MB encoded. This is expected.
Can I obfuscate a JSON Web Token (JWT) payload?
You can, but you should not. JWT payloads are signed; modifying them invalidates the signature. Obfuscation of a JWT makes it non-verifiable. Use this tool on JSON data files, not on signed tokens.
Does it handle Unicode keys?
Yes. Unicode keys and values are handled correctly. The parser decodes escape sequences, and the encoder uses UTF-8-aware Base64 encoding.
What if I lose the mapping file?
You cannot recover the original JSON from the obfuscated version without the mapping. The mapping is the key. Always store it alongside the obfuscated output, in a private location, and back it up.

Related Tools