Implements the ‘null’ value. --- common/mltools/JSON.ml | 2 ++ common/mltools/JSON.mli | 1 + 2 files changed, 3 insertions(+)
diff --git a/common/mltools/JSON.ml b/common/mltools/JSON.ml index 8c2e695e2..7418f1372 100644 --- a/common/mltools/JSON.ml +++ b/common/mltools/JSON.ml @@ -20,6 +20,7 @@ type field = string * json_t and json_t = + | Null | String of string | Int of int64 | Float of float @@ -106,6 +107,7 @@ and output_list fields ~fmt ~indent = ^ (print_dict_before_end ~fmt ~indent ~size) ^ (print_indent ~fmt ~indent) ^ "]" and output_field ~indent ~fmt = function + | Null -> "null" | String s -> json_quote_string s | Int i -> Int64.to_string i (* The JSON standard permits either "1" or "1.0" but not "1.". diff --git a/common/mltools/JSON.mli b/common/mltools/JSON.mli index c85b786ff..810de6460 100644 --- a/common/mltools/JSON.mli +++ b/common/mltools/JSON.mli @@ -20,6 +20,7 @@ type field = string * json_t (** ["field": "value"] *) and json_t = (** JSON value. *) + | Null (** special null value *) | String of string (** string value, eg. ["string"] *) | Int of int64 (** int value, eg. [99] *) | Float of float (** floating point value, eg. [9.9] *) -- 2.18.0 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
