package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A submodule containing logic for parsing JSON texts to values of type Cf_type.opaque according to optional mode selectors.

type mode

The mode selectors for scanning JSON texts to opaque values.

val mode : ?strings:[< `Text | `String ] -> unit -> mode

Use mode () to create a mode selector record for the opaque value scanner. Use any of the various optional parameters to set a mode selector to other than its default value. The modes are as follows:

  • strings: Controls how JSON strings are decoded, either as Ucs_text.t (the default) or as string.
val value : ?mode:mode -> unit -> Cf_type.opaque Annot.form t

Use value () to create an opaque value parser. The following table describes the runtime type indications produced for values decoded.

  • null: Cf_type.Unit
  • boolean: Cf_type.Bool
  • number: Cf_type.Int or Cf_type.Float
  • string: Ucs_type.Text
  • array: Cf_type.(Seq Opaque)
  • object: Cf_type.(Seq (Pair (Opaque, Opaque))

Use the ~mode parameter to select modes other than the default.

Note well: the array and object containers are sequences of untyped values, which must be unpacked recursively. Exceeding a maximum recursion depth of 1000 raises Bad_syntax.