Elm Exactly
Results / elm-json /

RoundTripNestedTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Json.Decode.at [ "a", "b" ]` reads the integer 42 from an object nested inside another object.

Results

elm-0.19.1

passran in 45 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rt_nested: Ok 42

elm-0.19.2

passran in 57 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rt_nested: Ok 42

elm-0.19.3

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rt_nested: Ok 42

lamdera-1.5.0

passran in 49 ms
Output
rt_nested: Ok 42

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-json/RoundTripNestedTest] in its title.

Source

The -- CHECK: lines give the expected output.

module RoundTripNestedTest exposing (main)
{-| `Json.Decode.at [ "a", "b" ]` reads the integer 42 from an object nested inside another object.
-}
-- CHECK: rt_nested: Ok 42
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
json = Encode.encode 0 (Encode.object [ ( "a", Encode.object [ ( "b", Encode.int 42 ) ] ) ])
_ = Debug.log "rt_nested" (Decode.decodeString (Decode.at [ "a", "b" ] Decode.int) json)
in
text "done"