2 ms·
Isn't decoding JSON a big part of an SPA though? How do you deal with data from the server?
by kristianp 9y ago
Isn't decoding JSON a big part of an SPA though? How do you deal with data from the server?
- antouank 9y agoOnce you handle a couple of complicated cases, you're ready to solve any JSON decoding within minutes. It's just a small learning curve to go through. Also, once you get the hang of it, you can use it as your safety layer for incoming data. To guard the app from any invalid response. I've even used GraphQL for one of my projects, decoding worked fine as well.
- enalicho 9y agoThere exist multiple tools to aid you with writing decoders: - json-to-elm http://json2elm.com http://json2elm.com - swagger-elm https://github.com/ahultgren/swagger-elm/ https://github.com/ahultgren/swagger-elm/ - elm-graphql https://github.com/jahewson/elm-graphql https://github.com/jahewson/elm-graphql, https://github.com/jamesmacaulay/elm-graphql https://github.com/jamesmacaulay/elm-graphql - elm-export https://hackage.haskell.org/package/elm-export https://hackage.haskell.org/package/elm-export Once you've got the hang of it, it's not that hard either. Just time consuming. That's where json2elm comes in :)