JSON Feed 1.1 parser and serializer
README.md

nox-jsonfeed #

Warning. This is a work-in-progress experimental fork of ocaml-jsonfeed. Do not use it in production; use ocaml-jsonfeed instead.

JSON Feed 1.1 is a syndication format, like RSS and Atom, written in JSON. nox-jsonfeed decodes, encodes and validates it. Each feed object (feed, item, author, attachment, hub, reference) is an abstract OCaml type with a nox-json codec, and members the specification does not name survive a decode and encode round trip. The package also reads the references extension, whose citations carry Citation Typing Ontology (CiTO) annotations.

Overview #

nox-jsonfeed is a fork of @anil.recoil.org/ocaml-jsonfeed with the jsont codec replaced by nox-json: a feed is read and written by Jsonfeed.codec through nox-json's of_string, of_reader, to_string and to_writer.

Usage #

$ opam install nox-jsonfeed
let roundtrip s =
  match Json.of_string Jsonfeed.codec s with
  | Error e -> Error (Json.Error.to_string e)
  | Ok feed -> Ok (Json.to_string Jsonfeed.codec feed)

API #

  • Jsonfeed.codec decodes and encodes a feed with nox-json's Json.of_string, Json.to_string and their reader and writer forms.
  • Jsonfeed.v builds a feed and Jsonfeed.validate checks the rules the types do not: a non-empty title, unique item identifiers, and authors with at least one field.
  • Jsonfeed.Item, Author, Attachment, Hub and Reference are the feed objects, each with a constructor v, accessors and a codec.
  • ocaml-jsonfeed is the upstream this package forks, by Anil Madhavapeddy, written over jsont.
  • nox-json is the JSON codec library this package uses, itself a fork of jsont.

License #

ISC (upstream's license). See LICENSE.md.