Kxclib.Json
type jv_field = string * jv
type jv_fields = jv_field list
val string_of_jv_kind : jv_kind -> string
whether two json value are equivalent, i.e. equal while ignoring ordering of object fields
pp_unparse ppf j
output j
as a JSON string. NB: this function does not check if j
contains any `str s
where s
is an invalid UTF-8 string. it just assumes so.
val unparse : jv -> string
unparse j
convert j
to a JSON string using pp_unparse
. see pp_unparse
for caveats.
pp_lit ppf j
output j
in a format that can be used as an OCaml literal.
val show : jv -> string
show j
convert j
to a string using pp_lit
, which is a string that can be used as an OCaml literal.
an empty path designate the root element
print a human-friendly version of the jvpath. e.g.
pp_jvpath []
prints .
(a single dot)pp_jvpath [`f "foo"]
prints .foo
pp_jvpath [`f "foo"; `f "bar"]
prints .foo.bar
pp_jvpath [`f "foo"; `i 4]
prints .foo[4]
pp_jvpath [`i 3]
prints .[3]
pp_jvpath [`i 3; `i 4]
prints .[3][4]
pp_jvpath [`i 3; `f "bar"]
prints .[3].bar
pp_jvpath [`f "f!oo"]
prints .["f!oo"]
val unparse_jvpath : jvpath -> string
unparse_jvpath path
converts path
to string in the same syntax as pp_jvpath
val parse_jvpath' :
?check_root:[ `check_root_prefix | `no_check ] ->
string ->
(jvpath, [ `pos of int | `premature_end of int ]) Stdlib.result
parse jvpath conforming the syntax of pp_jvpath
val parse_jvpath_opt :
?check_root:[ `check_root_prefix | `no_check ] ->
string ->
jvpath option
see parse_jvpath'
val parse_jvpath_exn :
?check_root:[ `check_root_prefix | `no_check ] ->
string ->
jvpath
see parse_jvpath'
type yojson =
[ `Null
| `Bool of bool
| `Int of int
| `Intlit of string
| `Float of float
| `String of string
| `Assoc of (string * 't) list
| `List of 't list
| `Tuple of 't list
| `Variant of string * 't option ] as 't
Yojson.Safe.t
type yojson' =
[ `Null
| `Bool of bool
| `Int of int
| `Float of float
| `String of string
| `Assoc of (string * 't) list
| `List of 't list ] as 't
Yojson.Basic.t
type jsonm = jsonm_token seq
type 'loc jsonm' = ('loc * jsonm_token) seq
type 'loc jsonm_pe = [
|
`empty_document
|
`premature_end of 'loc
with loc of the starting token of the inner-most structure (viz. array/object)
*)|
`expecting_value_at of 'loc
|
`unexpected_token_at of 'loc * jsonm_token
]