package repr

  1. Overview
  2. Docs

Overlay on top of Jsonm to work with rewindable streams.

type decoder

The type for JSON decoder.

val decoder : ?encoding:[< Jsonm.encoding ] -> [< Jsonm.src ] -> decoder

Same as Jsonm.decoder.

val decode : decoder -> [> `Await | `End | `Error of Jsonm.error | `Lexeme of Jsonm.lexeme ]

Same as Jsonm.decode.

val rewind : decoder -> Jsonm.lexeme -> unit

rewind d l rewinds l on top of the current state of d. This allows to put back lexemes already seen.

val decoder_and_lexemes : decoder -> Jsonm.decoder * Jsonm.lexeme list

decoder_and_lexemes d returns the underlying Jsonm.decoder and a list of lexemes you may have rewound. If you have not called rewind the list will be empty.

val assoc : 'a t -> (string * 'a) list t

assoc v is the typerepr of an association list (assoc) in which keys are strings and values are of typerepr v. The JSON codec represents such an assoc as a JSON object.

OCaml

Innovation. Community. Security.