[elm-discuss] Re: Json.Decode list of objects without known fields

2016-09-16 Thread Gary Young
In short. Solve this: module Main exposing (..) import Html -- import Json.Decode exposing (Decoder, decodeString, keyValuePairs) json : String json = """[{a: 1, foo: "bar", bar: "baz"}, {a: 2, foo: "baz", bar: "foo"}, {a: 34, foo: "big", bar: "lebowski"}]""" gen_keys : String -> Str

[elm-discuss] Json.Decode list of objects without known fields

2016-09-16 Thread Gary Young
I love Elm and I strongly believe that it's the future, but I can't solve this one use-case that's stopping me from using it. I have a list of JSON objects like this: [{a: 1, foo: "bar", bar: "baz"}, {a: 2, foo: "baz", bar: "foo"}, {a: 34, foo: "big", bar: "lebowski"}] At runtime the co

Re: [elm-discuss] Decoding JSON for Lists of Objects With Arbitrary Fields

2016-07-30 Thread Gary Young
sically, you can keep encoding things as this generic > "Json.Encode.Value" type, and nesting them inside one another. From Elm's > perspective, they're all the same type, so where javascript arrays could > have multiple things in them (e.g. ["one", 2, {3

[elm-discuss] Decoding JSON for Lists of Objects With Arbitrary Fields

2016-07-30 Thread Gary Young
Hi guys, I have a reporting app where actions by the user generate arbitrary lists of objects(records) coming back from a JSON store. I do not know at compile time what the fields in the objects(records) will be. Can Elm do this? How? Thanks in advance! -- You received this message becaus