Elm Exactly
Results / elm-json /

DecodeFieldTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Json.Decode.field` decodes the named field of a JSON object.

Results

elm-0.19.1

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

elm-0.19.2

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

elm-0.19.3

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

lamdera-1.5.0

passran in 68 ms
Output
decode_field: Ok "tom"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module DecodeFieldTest exposing (main)
{-| `Json.Decode.field` decodes the named field of a JSON object.
-}
-- CHECK: decode_field: Ok "tom"
import Html exposing (text)
import Json.Decode as Decode
main =
let
_ = Debug.log "decode_field" (Decode.decodeString (Decode.field "name" Decode.string) "{\"name\":\"tom\"}")
in
text "done"