It depends how much you control the JSON input. The technique from the article is great if you are certain the input will be in the correct shape, but it lacks error messages should validation fail (it just returns None).
There are a few community libraries for managing JSON, but I don’t know if any of them are officially recommended so I won’t link to them (yet).
This is not JSON “support”, it’s just a binding to the JavaScript JSON api. It can be used to implement JSON serialisation and deserialisation, and many of the community efforts rely on it.
It depends how much you control the JSON input. The technique from the article is great if you are certain the input will be in the correct shape, but it lacks error messages should validation fail (it just returns None).
Thanks, I think it can easily be modified to return result instead of option.
This is not JSON “support”, it’s just a binding to the JavaScript JSON api. It can be used to implement JSON serialisation and deserialisation, and many of the community efforts rely on it.
Using 3rd party lib
There are some libraries to handle the Json data. I’m not going to link here, but you can refer to the benchmark: ReScript decoding libraries benchmark
EDIT: the benchmark page seems updated that is missing some libraries compat to ReScript.
Here are some libraries I know: