似乎在Elm中处理JSON的唯一方法是通过Json.Decode解码每个JSON方案手动。
Json.Decode
有没有像F#的Type Provider这样的好选择?
F# Data: JSON Type Provider
没有官方软件包可以这样做,但是有一些类似这样的社区替代方案:https://github.com/eeue56/json-to-elm
基于JSON输入创建Elm类型别名和解码器此项目使您可以自动创建:type aliases from JSON data decoders from type aliases and some union types encoders from type aliases and some union types
基于JSON输入创建Elm类型别名和解码器
此项目使您可以自动创建:
type aliases from JSON data decoders from type aliases and some union types encoders from type aliases and some union types