What is JSON to Clojure Map Generator?
This tool converts JSON data into Clojure defrecord definitions or map literals with keyword keys. It automatically transforms JSON keys to Clojure keywords and handles nested structures, vectors, and all primitive types.
How to Use
- Choose the output format: defrecord for type definitions or map literal for direct data
- Paste your JSON data into the input area
- Click "Generate" and copy the output into your Clojure project
Why Use This Tool?
Tips & Best Practices
- Use defrecord when you need named types with field validation
- Use map literals when you need immediate data structures
- Nested objects become nested maps or separate defrecords
- JSON arrays are converted to Clojure vectors [item1 item2]
Frequently Asked Questions
How are JSON types mapped to Clojure?
JSON strings → "string", numbers → 123 or 3.14, booleans → true/false, null → nil, arrays → [item1 item2] (vectors), objects → {:key value} (maps).
What is defrecord in Clojure?
defrecord defines a record type in Clojure, which is a named data structure with a fixed set of fields. Records provide better performance than maps for known field sets and implement Java interfaces.
Why use keyword keys?
Keywords in Clojure (starting with :) are the idiomatic way to represent keys in maps. They are efficient for lookups and can be used as functions to extract values from maps.
How are nested objects handled?
In defrecord mode, nested objects become separate defrecord definitions. In map literal mode, nested objects become nested Clojure maps with proper indentation.
Is my data sent to a server?
No, all processing happens entirely in your browser. Your JSON data never leaves your device.