What is JSON to Redis Commands Converter?
This tool converts JSON data into Redis CLI commands. It intelligently maps JSON structures to the most appropriate Redis data types: strings and numbers become SET keys, objects with primitive values become HSET hashes, arrays become RPUSH lists, and objects with all-numeric values become ZADD sorted sets.
How to Use
- Optionally set a key prefix to namespace your Redis keys
- Choose output format: Redis CLI (one command per line) or Pipeline (wrapped in PIPELINE/EXEC)
- Paste your JSON data into the input area and click "Generate Redis Commands"
- Copy the output and run the commands in your Redis CLI or application
Why Use This Tool?
Tips & Best Practices
- Use colon-separated keys (e.g. "user:1001") in your JSON for natural Redis key patterns
- Objects with all-numeric values are automatically converted to sorted sets (ZADD)
- The pipeline format batches all commands for efficient execution in a single round trip
- Boolean values are stored as 1 (true) and 0 (false) for Redis compatibility
Frequently Asked Questions
How does the tool decide which Redis command to use?
The tool uses smart type detection: top-level string/number values use SET, objects with primitive values use HSET, arrays use RPUSH, and objects where all values are numbers use ZADD (sorted sets). Nested objects are flattened into colon-separated keys.
What is the difference between CLI and Pipeline format?
CLI format outputs one command per line, suitable for direct execution in redis-cli. Pipeline format wraps all commands in PIPELINE/EXEC blocks, which allows Redis to execute them in a batch for better performance.
How are boolean values handled?
Redis does not have a native boolean type. Boolean values are converted to strings: true becomes "1" and false becomes "0", which is a common convention in Redis.
What about nested objects and arrays?
Nested objects are flattened using colon-separated key patterns. For example, {"user": {"profile": {"name": "Alice"}}} becomes SET prefix:user:profile:name Alice. Arrays of objects generate separate keys with index-based suffixes.
Is my JSON data sent to a server?
No, all processing happens entirely in your browser. Your JSON data never leaves your device.