3 ms·
I suspect the parent wants to convert between JSON and typed records without needing the JSON to conform to the type.
by dboreham 7y ago
I suspect the parent wants to convert between JSON and typed records without needing the JSON to conform to the type.
- yakshaving_jgt 7y agoOk, but this works just fine in Haskell. If you have a well-formed JSON string and you want to parse it as a generic value, you can parse it into the Value type. If you have a typed record (something less general than a Value) and a JSON string that has enough of the structure to be parsed into that typed record, you can parse it into that typed record. If the JSON string has extra structure/data/fields your parser didn't expect, it's fine. Your JSON parser in Haskell can ignore those extra things. Just like any dynamic language. All of this was demonstrated in the article.