Skip to content

格式化与代码

JSON 转 Haskell Data Type

Haskell records with FromJSON / ToJSON instances.

Runs in your browser

编辑注

Understanding · Records, deriving, and FromJSON.

本深度章节目前仅有英文版本。上方的转换工具支持您的语言;长篇说明文章尚未翻译。

常见问题

Quick answers.

Which Haskell libraries are supported?

The generator focuses on the `Aeson` library, producing `FromJSON` and `ToJSON` instances compatible with modern Haskell development.

How does it handle nested objects?

Nested JSON objects are converted into separate Haskell data types, with the parent record referencing these types as fields.

Are Haskell naming conventions followed?

Yes. The tool converts snake_case or camelCase JSON keys into valid Haskell record fields, typically prepending the type name to avoid namespace collisions.

Can I use this for complex arrays?

Arrays of objects are mapped to Haskell lists of a specific type, while mixed-type arrays may require manual adjustment into a Sum type or `Value`.

大家也在搜索

相关工具

More in this room.

查看所有 格式化与代码