I have a port that will respond with some JSON from a web service
(Blockspring). I'm using their custom library, so a REST call won't work.
I've set up the port call, which works fine. But I'm not sure how to set up
the port to *receive* JSON and then turn that into Elm. I've read through
the HTTP, JSON, and interop portions of the elm guide, but I can't figure
out how to put it all together for this use case.
The JSON looks arbitrarily like this;
var projects = [
{ "project_name": "Gulf Coast", "email": "[email protected]" },
{ "project_name": "Sunny Lake", "email": "[email protected]" }
]
It's just a list of objects that have key/value pairs (which are all
Strings except for one timestamp)
I also can't figure out the type definition, I've tried a bunch of things.
port response : ??? -> Sub msg
1) What's the correct function signature here?
2) How do I decode that JSON to an Elm type of List Project? Without the
decoder function call of Http.get, I am pretty stumped.
Thanks!
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.