2016-12-01 21:27:53 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-12-01 21:27:53 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-01-23 14:09:45 +04:00
|
|
|
open Error_monad
|
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
(** Read a JSON document from a string. *)
|
|
|
|
val from_string : string -> (Data_encoding.json, string) result
|
|
|
|
|
|
|
|
(** Read a stream of JSON documents from a stream of strings.
|
|
|
|
A single JSON document may be represented in multiple consecutive
|
|
|
|
strings. But only the first document of a string is considered. *)
|
|
|
|
val from_stream : string Lwt_stream.t -> (Data_encoding.json, string) result Lwt_stream.t
|
|
|
|
|
|
|
|
(** Write a JSON document to a string. This goes via an intermediate
|
|
|
|
buffer and so may be slow on large documents. *)
|
2017-12-07 20:43:21 +04:00
|
|
|
val to_string : ?minify:bool -> Data_encoding.json -> string
|
|
|
|
|
|
|
|
val pp : Format.formatter -> Data_encoding.json -> unit
|
2016-12-01 21:27:53 +04:00
|
|
|
|
|
|
|
(** Loads a JSON file in memory *)
|
2017-01-23 14:09:45 +04:00
|
|
|
val read_file : string -> Data_encoding.json tzresult Lwt.t
|
2016-12-01 21:27:53 +04:00
|
|
|
|
|
|
|
(** (Over)write a JSON file from in memory data *)
|
2017-01-23 14:09:45 +04:00
|
|
|
val write_file : string -> Data_encoding.json -> unit tzresult Lwt.t
|