DecodeAtTest
`Json.Decode.at [ "a", "b" ]` follows nested object fields and decodes the value found there.
Results
elm-0.19.1
passran in 66 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. decode_at: Ok 42
elm-0.19.2
passran in 56 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. decode_at: Ok 42
elm-0.19.3
passran in 60 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. decode_at: Ok 42
lamdera-1.5.0
passran in 42 msOutput
decode_at: Ok 42
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-json/DecodeAtTest] in its title.
Source
The -- CHECK: lines give the expected output.
module DecodeAtTest exposing (main)
{-| `Json.Decode.at [ "a", "b" ]` follows nested object fields and decodes the value found there.
-}
-- CHECK: decode_at: Ok 42
import Html exposing (text)
import Json.Decode as Decode
main =
let
_ = Debug.log "decode_at" (Decode.decodeString (Decode.at ["a", "b"] Decode.int) "{\"a\":{\"b\":42}}")
in
text "done"