package ezjsonm
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=527dbd3f930570ced1052f20b8844fe92a87adca7ec870fe9353695902f3d2b5
md5=e8f207c6cd2226b2c4784b1e56556797
doc/ezjsonm/Ezjsonm/index.html
Module EzjsonmSource
An easy interface on top of the Jsonm library.
This version provides more convenient (but far less flexible) input and output functions that go to and from string values. This avoids the need to write signal code, which is useful for quick scripts that manipulate JSON.
More advanced users should go straight to the Jsonm library and use it directly, rather than be saddled with the Ezjsonm interface below.
Basic types
type value = [ | `Null| `Bool of bool| `Float of float| `String of string| `A of value list| `O of (string * value) list
]JSON fragments.
wrap v wraps the value v into a JSON array. To use when it is not possible to statically know that v is a value JSON value.
unwrap t is the reverse of wrap. It expects t to be a singleton JSON object and it return the unique element.
Reading JSON documents and values
Read a JSON document from an input channel.
Read a JSON value from an input channel.
Low-level function to read directly from a Jsonm source.
Writing JSON documents and values
Write a JSON document to an output channel.
Write a JSON document to a string. This goes via an intermediate buffer and so may be slow on large documents.
Write a JSON value to an output channel.
Write a JSON value to a buffer.
Write a JSON value to a string. This goes via an intermediate buffer and so may be slow on large documents.
Low-level function to write directly to a Jsonm destination.
Constructors
Build a triple.
Accessors
All the following accessor functions expect the provided JSON document to be of a certain kind. In case this is not the case, Parse_error is raised.
Extract the elements from a dictionnary document.
Extract the triple.
High-level functions
Find the sub-document adressed by the given path. Raise Not_found if the path is invalid.
Update the sub-document addressed by the given path. If the provided value is None, then removes the sub-document.
Apply a given function to a subdocument.
Convert a (possibly non-valid UTF8) string to a JSON object.
Convert a JSON object to a (possibly non-valid UTF8) string. Return None if the JSON object is not a valid string.
Convert a JSON object to a (possibly non-valid UTF8) string.
Convert a JSON fragment to an S-expression.
An alias of to_sexp
Convert a JSON object to an S-expression
Convert an S-expression to a JSON fragment
AN alias of of_sexp
Convert an S-expression to a JSON object