DecodeIndexTest
`Json.Decode.index 1` decodes the second element of a JSON array.
Results
elm-0.19.1
passran in 62 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. decode_index: Ok "world"
elm-0.19.2
passran in 59 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. decode_index: Ok "world"
elm-0.19.3
passran in 42 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. decode_index: Ok "world"
lamdera-1.5.0
passran in 56 msOutput
decode_index: Ok "world"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-json/DecodeIndexTest] in its title.
Source
The -- CHECK: lines give the expected output.
module DecodeIndexTest exposing (main)
{-| `Json.Decode.index 1` decodes the second element of a JSON array.
-}
-- CHECK: decode_index: Ok "world"
import Html exposing (text)
import Json.Decode as Decode
main =
let
_ = Debug.log "decode_index" (Decode.decodeString (Decode.index 1 Decode.string) "[\"hello\",\"world\"]")
in
text "done"