Bs-json Encoder Examples?


#1

I’m trying to figure out how to write a custom Json Encoder using bs-json, and I’m having trouble understanding the examples in the repo. The object I want to encode is in the format list(customType). Any idea on how to approach this?

Thanks!


#2

Maybe my old article can help you: https://medium.com/@DmytroGladkyi/decode-and-encode-json-in-reasonml-2d484c65cf4e


#3

@gladimdim Thanks for the help! I looked at your guide and the examples again, and I was able to come up with a solution. I figure I’ll leave this here in case it helps anyone else https://github.com/reccanti/shmonsters-reason/blob/master/src/Store.re.


#4

I see the issues here. In bs-json the tests are in OCaml with it’s respective syntax, not in reason. I will try and work on getting some examples in the bs-json.


#5

You can copy and paste the code to the OCaml section of https://reasonml.github.io/en/try.html to get ReasonML back