Decoder
A decoder is a function that takes a JSON value and transforms it into an F# value.
Example of a successful decoder:
Decode.fromString Decode.int "1"
Returns:
Ok 1
Example of a failed decoder:
In case of an error, a decoder returns an helpful errors explaining:
Where the error happened in the JSON using the JSONPath syntax.
You can use tools like JSONPath Online Evaluator to explore your JSON
What was expected
What was received
Decode.fromString Decode.int "\"maxime\""
Returns:
Error at: `$`
Expecting an int but instead got: "maxime"