[ANN] jsonoo 0.1.0

Hello! I am announcing the first release of jsonoo, a JSON library for Js_of_ocaml.


This library provides a very similar API to the excellent BuckleScript library, bs-json by glennsl. Unlike bs-json, this port of the library tries to follow OCaml naming conventions and be easier to interface with other OCaml types like Hashtbl.t . This library passes a nearly equivalent test suite.

This project is part of ongoing work to port vscode-ocaml-platform to Js_of_ocaml.

Generated documentation can be found here.

Thank you!
- Max

9 Likes

Really cool work, bs-json is a staple in most BuckleScript projects.
Is there a reason you’re not using Yojson?

The main goal of this first release was to provide a similar-enough API to bs-json to simplify the porting process for vscode-ocaml-platform with minimal code changes. I’m not that familiar with Yojson, which would make it difficult to port the ways vscode-ocaml-platform uses JSON.

Yojson does seem to be quite popular, so I will investigate adding interoperability for a later release. If you are starting a Js_of_ocaml project from scratch it might be preferable to start with Yojson from the beginning.

Yojson won’t be very helpful here as jsoo already provides json encoding/decoding via the browser API.

However, it’s still not ideal to tie an encoding/decoding API to the underlying json implementation. It would be nice if encoders/decoders were more usable.

This all just reminded me of https://github.com/OCamlPro/ocplib-json-typed. I wonder why don’t we just use that, it seems to offer everything we want for the browser side.

That library looks quite interesting. I will take a look. Thank you for sharing.

I think the latest versions are hosted here: https://gitlab.com/nomadic-labs/json-data-encoding

1 Like