I have published the initial (minimal) release of json2elm. You can use it to generate elm/json decoders & encoders (+ type definitions) from a JSON sample. It supports nested objects and arrays, but doesn’t de-duplicate array items for now.
I’m keen to get feedback on it. In particular, some questions I’m considering:
- Should it detect integers? Currently it treats all numbers as
- Should it generate imports as well (this will be perhaps more relevant with more options for generation such as pipeline decoders)?
- Should it support miniBill/elm-codec?
There are things I’m already considering for future development:
- Adding settings to customise imports (eg. to generate
- Adding an option for applicative style decoders (About the Ergonomics of Applicative JSON Decoding - #19 by dillonkearns)
- Adding pipeline decoders
- An elm-review rule to convert a string into decoders/encoders, similarly to dillonkearns/elm-review-html-to-elm
- A CLI to complement the web UI
- De-duplicating type definitions (particularly from array items of the same type, which is very likely in copy-pasted JSON samples)
- Using JSON schemas as input in addition to regular JSON documents.
- Getting a JSON sample from a URL.
Please let me know if any of these are of particular interest.