Search code examples
elm

Decode a tuple in elm


I'm looking for a way to decode a tuple with two elements in elm.

[[String, Bool]]

The outer list is easy enough to parse with Json.list, but how do I decode the array as a tuple ? I tried the solution from Decode a JSON tuple to Elm tuple but all I get is errors about types of Decoder and Maybe, I assume something changed in elm since that answer. Or maybe I'm missing an import, I don't know.

Thanks


Solution

  • simplest is

    map2 (,) (index 0 string) (index 1 string)