mltools: JSON: Implement JSON.Null.

Implements the ‘null’ value.
This commit is contained in:
Richard W.M. Jones
2018-08-22 15:31:59 +01:00
parent 38f688b8b5
commit f9994c7ffb
2 changed files with 3 additions and 0 deletions

View File

@@ -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.".

View File

@@ -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] *)