[ANN] Yojson 2.0.0

Hello fellow Camel-wranglers,

This Friday, it is my pleasure to announce the release of Yojson 2.0.0. You can get it in your local OPAM repository.

Key highlights include:

  • Fewer dependencies: Given Yojson is a common dependency we cut down on its dependencies so you have to install less and have less transitive dependencies
  • Seq interface: Since OCaml 4.14 deprecates Stream and 5.0 removes it, this was a good time to change to this interface
  • Buffer interface: coming along with #1, we changed Yojson to use Buffer wherever it was using Biniou types before

Thanks to everybody involved in this release!

If Yojson sounds like an interesting project for you to contribute, join us.

Full changelog follows:




  • Removed dependency on easy-format and removed pretty_format from
    Yojson, Yojson.Basic, Yojson.Safe and Yojson.Raw. (@c-cube, #90)
  • Removed dependency on biniou, simplifying the chain of dependencies. This
    changes some APIs:
    • Bi_outbuf.t in signatures is replaced with Buffer.t
    • to_outbuf becomes to_buffer and stream_to_outbuf becomes
      (@Leonidas, #74, and @gasche, #132)
  • Removed yojson-biniou library
  • Removed deprecated json type aliasing type t which has been available
    since 1.6.0 (@Leonidas, #100).
  • Removed json_max type (@Leonidas, #103)
  • Removed constraint that the “root” value being rendered (via either
    pretty_print or to_string) must be an object or array. (@cemerick, #121)
  • Removed validate_json as it only made sense if the type was called json.
    (@Leonidas, #137)


  • Add an opam package yojson-bench to deal with benchmarks dependency
    (@tmcgilchrist, #117)
  • Add a benchmark to judge the respective performance of providing a buffer vs
    letting Yojson create an internal (#134, @Leonidas)
  • Add an optional suf keyword argument was added to functions that write
    serialized JSON, thus allowing NDJSON output. Most functions default to not
    adding any suffix except for to_file (#124, @panglesd) and functions
    writing sequences of values where the default is \n (#135,


  • The stream_from_* and stream_to_* functions now use a Seq.t instead of a
    Stream.t, and they are renamed into seq_from_* and seq_to_* (@gasche, #131).


  • Avoid copying unnecessarily large amounts of strings when parsing (#85, #108,
  • Fix stream_to_file (#133, @tcoopman and @gasche)

Yay!! That was a long time coming. Thank you! :smiley: