Elm 有 JSON 类型提供程序吗?

Does Elm have JSON Type Provider?

似乎在 Elm 中处理 JSON 的唯一方法是 Json.Decode 手动 解码每个 JSON 方案 Json.Decode

是否有像 F# 的 Type Provider 之类的不错的替代方案?

F# Data: JSON Type Provider

没有官方软件包可以执行此操作,但有像这样的社区替代方案:https://github.com/eeue56/json-to-elm

Create Elm type aliases and decoders based on JSON input

This project allows you to automate the creation of:

  • type aliases from JSON data
  • decoders from type aliases and some union types
  • encoders from type aliases and some union types