JSON → Haskell records (aeson)
ClientPaste JSON to emit record types with Text, Double, lists, and nested types plus aeson Generic codecs—adjust jsonOpts and nullability in your project.
Learn more: JSON and Haskell
Emit record types with `Text`, `Double`, lists, `Value` for JSON null in the sample, and nested types—each gets stock `Generic` plus aeson `FromJSON`/`ToJSON` using shared `jsonOpts`.
JSON keys vs jsonOpts
The scaffold sets `fieldLabelModifier = id`, so encoded JSON keys match Haskell field names exactly. APIs that use snake_case or different casing usually need a different `Options` value (for example `camelTo2` variants or a custom modifier)—swap `jsonOpts` before relying on decoding.
Scope
Arrays infer item shape from the first element only; numbers default to `Double`. Replace `Value` with concrete `Maybe` types once you know how null appears across responses.
JSON → Haskell
?
Parses JSON in your browser and emits classes inferred from the sample shape. Nested objects become nested types; arrays use the first element only to guess item shape. Nothing is uploaded.
Uses aeson Generic with fieldLabelModifier = id— JSON keys must match record fields exactly (camelCase fields). Switch jsonOpts (for example snake-case keys) when your wire format differs; replace Value with concrete Maybe types after you know null shapes.
Common use cases
- Draft aeson-friendly records before wiring HTTP clients or servant handlers.
- Compare inferred shapes across Scala, Rust, and Haskell when reviewing API payloads.
- Share a portable Haskell skeleton in docs when the JSON sample is fixed.
Common mistakes to avoid
Expecting snake_case JSON keys with fieldLabelModifier = id
The scaffold keeps JSON keys identical to record field names. Switch jsonOpts (for example camelTo2 or custom modifiers) when your wire format uses snake_case or different conventions.
Trusting Double and Value from a single sample
Numbers map to Double; JSON null maps to Value. Tighten to Int, Scientific, or Maybe types once you know the real contract.
FAQ
Is Haskell code generated on your servers?
No. Generation runs locally in your browser.
Does this add orphan instances or Template Haskell?
No. Output uses stock Generic deriving and explicit FromJSON/ToJSON instances only.
Common search terms
Phrases people search for that match this tool. See the full long-tail keyword index.
- json to haskell types online
- json to aeson records
More tools
Related utilities you can open in another tab—mostly client-side.
JSON → Rust structs (serde)
ClientSerde structs with JSON renames from sample data—local only.
JSON → Scala case classes
Clientfinal case class scaffolding from sample JSON—Seq types, local only.
JSON → Kotlin data classes
ClientKotlin data classes from sample JSON—nested types from one example, local only.
JSON → Nim types
ClientNim object types from sample JSON—snake_case fields, seq for arrays, browser-side.