Reputation: 75
I am trying to JSON.Encode
a Set String
into a JSON list.
Encode.list <| Set.map Encode.string mySet
How should I do?
Upvotes: 2
Views: 526
Reputation: 21007
You might want to think of doing this with a pipe instead, as that can be more readable
mySet
|> Set.map Encode.string
|> Set.toList
|> Encode.list
Upvotes: 6
Reputation: 75
Thank to the help I got from the Elm community on slack, I found a way to do it:
Encode.list <| List.map Encode.string <| Set.toList mySet
Upvotes: 3