Here's my decoder:
decodeData : Json.Decoder (Id, String)
decodeData =
Json.at ["data", "0"]
<| Json.object2 (,)
("id" := Json.int)
("label" := Json.string)
The id
should logically be Int
however my backend sends it as String
(e.g. we get "1"
instead of 1
).
How can I cast the decoded value to Int
?