JSON to Elixir Map/Struct Converter
Paste JSON, get Elixir maps or defstruct modules — typespecs, from_map/1 — copy or download as .ex
Options
You’re building a Phoenix API client and need to work with JSON responses. Elixir’s pattern matching works great with maps, but for complex nested data, defstruct modules give you compile-time guarantees and cleaner function signatures.
What This Tool Does
Paste JSON and get Elixir code instantly — either plain maps with atom keys, or full defstruct module definitions with @type typespecs and from_map/1 constructor functions. Nested objects become nested modules.
Everything runs in your browser. Your data never leaves your device.
When to Use This
- Phoenix API integration — generate structs for JSON responses from external services
- Ecto schema reference — use generated structs as a starting point for Ecto embedded schemas
- GenServer state — define typed state structs from configuration JSON
- Data pipeline processing — convert JSON schemas into Elixir structs for ETL pipelines
Map vs Struct Output
Map output gives you an Elixir map literal with atom keys — useful for quick prototyping or IEx exploration.
Struct output generates full modules with:
defstructwith all fields and defaults@type t()typespec for Dialyzerfrom_map/1function for constructing structs from decoded JSON
FAQ
Does this send my JSON to a server?
No. All processing happens entirely in your browser.
How are nested objects handled?
Each nested JSON object becomes its own Elixir module with defstruct. Module names are derived from the parent module and the field key.