Mold v0.2.0 is a zero-dependency Elixir library for parsing external payloads (JSON APIs, webhooks, HTTP params) into clean Elixir terms. It defines a type system using plain Elixir data — atoms, functions, or tuples — covering scalar types (string, integer, float, boolean, atom), date/time types, collections (list, map, tuple), union types, and custom function types. Shared options like nilable, default, transform, validate, and in apply to all types. Maps support field-by-field parsing with flexible source key mapping, optional fields, and homogeneous key/value forms. The library returns structured errors with trace paths pointing to the exact failing location.

17m read timeFrom hexdocs.pm
Post cover image
Table of contents
TypesShared options

Sort: