Search code examples
elm

Does Elm have JSON Type Provider?


It seems that the only way to handle JSON in Elm is to decode each JSON scheme manually by Json.Decode.

Is there a nice alternative like F#'s Type Provider or something?

F# Data: JSON Type Provider


Solution

  • There is no official package doing this but there are community alternatives like this one: 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