ToolHub
Open Tool

JSON to Elixir Struct

Convert JSON to Elixir struct definitions with defstruct and type specifications

Developer Tools

About This Tool

JSON to Elixir Struct converts JSON data into Elixir struct definitions with automatic type detection. It generates clean Elixir modules with defstruct, default values, and @type t specifications for each field. This tool is ideal for Elixir and Phoenix developers building data models from API responses.

Key Features

Quick Preview

Use Cases

json elixir struct phoenix

Frequently Asked Questions

What is JSON to Elixir Struct?

JSON to Elixir Struct is a browser-based tool that converts JSON data into Elixir struct definitions with automatic type detection. It generates modules with defstruct, default values, and @type t specifications.

Does it support nested objects?

Yes, the tool automatically generates separate Elixir modules for nested JSON objects. Each nested struct is defined in its own module with proper namespacing for clean organization.

What type specifications are generated?

The tool generates @type t specifications for each struct field, mapping JSON types to Elixir types such as String.t(), integer(), float(), boolean(), list(any()), and map().

Can I customize the module name?

Yes, you can set a custom root module name using the Root name input field. The default name is "Root" but you can change it to match your project's naming conventions.

Is my JSON data sent to any server?

No. All conversion happens locally in your browser. Your JSON data is never uploaded or transmitted to any server, keeping it completely private and secure.