package orsetto
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=bb2af4d8b376b2d60fa996bd4d3b90d9f3559455672540f6d7c3598af81d483b
    
    
  md5=f7bfa83013801b42fcdba607af2f012b
    
    
  doc/orsetto.json/Json_scan/Object/index.html
Module Json_scan.Object
The record scanner module for JSON object content.
type field = - | Required : {- nym : 'a Cf_type.nym;
- scan : 'a Annot.form t;
 - } -> field(*- A field of the named type is required. *)
- | Optional : {- nym : 'a Cf_type.nym;
- scan : 'a Annot.form t;
 - } -> field(*- A field of the named type is optional. *)
- | Default : {- nym : 'a Cf_type.nym;
- scan : 'a Annot.form t;
- default : 'a;
 - } -> field(*- A field of the named type is optional with a default value. *)
Field descriptor type. A schema contains a map of indexes to values of this type, which indicate whether the field is required or optional, along with a description of the type of the field value and a scanner for values of that type.
val schema : ?ignore:(int * unit t) -> (Ucs_text.t * field) list -> schemaUse schema fields to make a record schema for scanning records according to fields. If ~ignore:(n, p) is provided, then as many as n unrecognized fields are scanned according to p and their values are discarded.
val range : schema -> int * intUse range schema to get the minimum and maximum number of fields that can be processed by scanning with schema.
Use scan schema to scan a record according to schema producing a pack value containing all the values in the record.
val unpack : pack -> Ucs_text.t -> 'a Cf_type.nym -> 'a Annot.formUse unpack pack index nym to unpack from pack the value for the field named by index with the type nym.
Note well: fields with Optional type in the schema are packed with the corresponding Cf_type.Option type nym, and the unpacked value is either Some v if the field is present in the scanned record, or None if the field was not present.