mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
mltools: JSON: Implement JSON.Null.
Implements the ‘null’ value.
This commit is contained in:
@@ -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.".
|
||||
|
||||
@@ -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] *)
|
||||
|
||||
Reference in New Issue
Block a user