JSON (JavaScript Object Notation) is the standard data interchange format for modern APIs, configurations, and state persistence. However, raw JSON files are plain text, human-readable, and often contain descriptive keys that expose internal schema architectures or increase network payload size.
In this article, we analyze techniques for compressing, protecting, and obfuscating JSON data before client transmission or offline storage.
1. Property Name Dictionary Substitution
In large datasets, repeating key names (e.g. "transaction_identifier", "user_authentication_token") consume significant memory and reveal internal naming conventions.
By mapping repeated keys to short deterministic token identifiers (e.g. "k0", "k1", "k2"), you achieve dual benefits:
- Payload Reduction: Reduces file sizes by 30% to 60% before gzip/brotli compression.
- Schema Obfuscation: Prevents casual inspection of field definitions and business logic.
// Original JSON:
[
{"productId": 101, "productName": "Screwdriver", "inStock": true},
{"productId": 102, "productName": "Hammer", "inStock": false}
]
// Obfuscated Payload with Key Map:
{
"__map": {"k0": "productId", "k1": "productName", "k2": "inStock"},
"data": [
{"k0": 101, "k1": "Screwdriver", "k2": true},
{"k0": 102, "k1": "Hammer", "k2": false}
]
}
2. Unicode Hexadecimal Escaping
For sensitive strings, keys, or metadata, strings can be encoded using standard JSON-compliant Unicode escapes (\uXXXX). Standard JSON parsers evaluate these transparently, but scrapers and static inspection tools cannot read them without decoding.
// Plaintext: "apiKey": "live_sec_99182"
// Unicode Hex Encoded: "\u0061\u0070\u0069\u004b\u0065\u0079": "\u006c\u0069\u0076\u0065\u005f..."
Interactive JSON Obfuscator & Compressor
Use our browser-based utility to minify, dictionary-encode, and hex-escape JSON payloads with 100% reversible decompression.