package awsm-codegen
Module Awsm_codegen.Json_parserSource
A parser returning a value of type 'a.
It can act on a JSON value using the run function.
Run the parser against a JSON value. The Error case contains information about where an error occured in the JSON document.
Low-level way to define a parser. Prefer combining other functions from this module, as it will return better error messages.
When returning an error, only include the error message: the location data will be added automatically by this module.
Map over a parser, with a function that can return an error.
Convert an homogeneous dictionary. It is an object where all values have the same type. For example, {"x": 1, "y": 2, "z": 3} can be parsed using dict int to [("x", 1); ("y", 2); ("z", 3)].
An abstract value representing values in a JSON record. To parse such a record, use record.
Applicative interface for record. The ppx_let syntax extension uses this to translate let%map x1 = v1 and x2 = v2 in e.
A required field. If not present, will return an error.
An optional field. If not present, will return None.
Like field_opt, but will return default if the field is not present.
Ignore this field. This completely ignores the presence, type and value of this field. It is usually better to parse the field with its correct type, and ignore it in the calling code.
Parse a JSON record. In addition to returning the correct data, it will also check that all fields in the record have been parsed explicitly.
If the JSON value being parsed is a record, parse it (and return a singleton). If it is a list, parse a list of records.
Support for type/value objects. field_based key get_parser will parse the current JSON value as an object, inspect the string value at the given key, and pass it to get_parser. The return value of this function determines how the rest of the record will be parsed.