Re: [elm-discuss] Using Elm with JSON when you do not know the names and types of the properties at compile time

2016-12-07 Thread Max Goldstein
You know about Json.Decode.andThen, right? It lets you chain callbacks that decode the JSON based on previous decoding passes. -- 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, sen

Re: [elm-discuss] Using Elm with JSON when you do not know the names and types of the properties at compile time

2016-12-07 Thread Hans Rune Bergheim
Thanks for answering, Nick. Hmm… The widgets would be displaying different things, depending on what kind of widget it is. Some would need text, others could perhaps need integers or floats. I like your suggestion that the widget will decode to the type that it needs. As you mention I sho

Re: [elm-discuss] Using Elm with JSON when you do not know the names and types of the properties at compile time

2016-12-06 Thread Nick H
What sorts of widgets are we talking about? If you know what sorts of widgets you are displaying, then you should also know what types of data they need. If this is true, then you could decode your JSON to simple "Dict String Json.Value". Then your widgets will have more fine-grained decoders conn

[elm-discuss] Using Elm with JSON when you do not know the names and types of the properties at compile time

2016-12-06 Thread Hans Rune Bergheim
Hi! I'd like to create a simple dashboard in Elm, that displays some graphs and numbers from json-data. The dashboard should be fully configurable, meaning that the users should have a config-file saying they would like to get data from service foo, and want to display widget a, b and c, us