package orsetto

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

JavaScript Object Notation (JSON) events.

Overview

As defined in ECMA-404 and RFC 8259, a JSON text is a sequence of Unicode characters conforming to a formally defined grammar comprising structured data.

This module provides a safe interface for constructing valid JSON events used by the scanners and emitters defined in Json_scan and Json_emit.

Types
type signal = [
  1. | `Syn_array
  2. | `Fin_array
  3. | `Syn_object
  4. | `Fin_object
  5. | `Con_element
  6. | `Con_member
]

The type of sequencing signals.

type t = private
  1. | Space
  2. | Null
  3. | False
  4. | True
  5. | Zero
  6. | Integer of int
  7. | Float of float
  8. | String of Ucs_text.t
  9. | Signal of signal

The private type of JSON events.

Equivalence relation

include Cf_relations.Equal with type t := t
val equal : t -> t -> bool

Use equal a b to compare a and b, returning true if the two values are equivalent, otherwise false.

Constructors
val space : t

The distinguished "space" event.

val null : t

The distinguished "null" event.

val signal : [< signal ] -> t

Use signal s to make an event signaling s.

val boolean : bool -> t

Use boolean b to select either the distinguished "true" or "false" event according to b.

val zero : t

The distinguished numeric zero event.

val integer : int -> t

Use integer n to make a numeric event Integer n, or Zero in the special case that n = 0.

val float : float -> t

Use float n to make a numeric event representing n. If n is a zero, then the result is Zero. Otherwise if the value of n can be represented as an OCaml integer without overflow or truncation, then the result is Integer (Float.to_int n). Otherwise, if n is a number and is not an infinity, then Float n is the result. Finally, in the cases where n is an infinity or not a number, raises Invalid_argument.

val string : Ucs_text.t -> t

Use string t to make String t.