Re: [elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
Yes, I can see that. What I was looking for is instead a function that says "take the string you give me and give me a Json.Value." It looks like my only alternative is instead to create the Json.Value out of a complex nested structure of Json.Encode.object, and corresponding Elm tuples,

[elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
Spoke too soon; that doesn't work. For example: > foo = Json.Encode.string "[]" "[]" : Json.Encode.Value > bar = Json.Decode.decodeValue (Json.Decode.list Json.Decode.string) foo Err "Expecting a List but instead got: \"[]\"" : Result.Result String (List String) On Friday, July 29, 2016

[elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
To answer my own question -- it looks like Native.Json has an identity function which does just what I want, but which I can't import. However, it also looks like many of Json.Encode's functions just call Native.Json.identity. So this works: data = Encode.string complicatedNestedJson On