package jsonaf
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0c85230d47dcc80c428ad82e0f2cb0ecbb5048129eaa036aeeb4cfb8d9d2063f
doc/jsonaf/Jsonaf/index.html
Module JsonafSource
type t = [ | `Null| `False| `True| `String of Base.string| `Number of Base.string| `Object of (Base.string * t) Base.list| `Array of t Base.list
] constraint t = Jsonaf_kernel.tNote that we intentionally do not expose compare or equal functions for t. Objects in JSON are considered unordered, so two different representations of t may be unequal using the derived equal but the same according to the JSON spec.
exactly_equal checks equality including exact key order within objects
parse s parses a single JSON object from s. It is an error if s does not contain exactly one JSON object. See parse_many.
parse_many parses zero or more JSON objects from s.
Caveats: parse_many succeeds only if all JSON objects parse, and its error messages may be significantly worse than those from parse.
To get the well-formed objects up to the syntax error, and then a good error message, consider piping through jq -c, splitting on newlines, and then parsing each line with parse. But this is much slower than run_many.
human-readable output, indenting all fields/array elements by two spaces.
include Base.Pretty_printer.S with type t := t
Same as member, but returns `Null instead of None if the member isn't present. This function is useful when migrating from Yojson, as it is equivalent to Yojson.Safe.Util.member. If writing new code using Jsonaf, you should probably avoid it. Consider using Of_json instead.
If t is a json number but not parseable as a float, float t returns None. Similarly int t will return None if the number is not parseable as an int.
If t is an object, return the association list between keys and values. Otherwise, return None. O(1).
If t is an object, return the association list between keys and values. Otherwise, raise. O(1).
If t is an object, return the keys of that object. Otherwise, return None. O(n).
If t is an object, return the keys of that object. Otherwise, raise. O(n).