1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
let json_value =
`Assoc
[
("null", `Null);
("bool", `Bool true);
("int", `Int 0);
("intlit", `Intlit "10000000000000000000");
("float", `Float 0.);
("string", `String "string");
("list", `List [ `Int 0; `Int 1; `Int 2 ]);
("assoc", `Assoc [ ("value", `Int 42) ]);
]
let crlf = "\r\n"
let snippets =
[
"{";
{|"null":null,|};
{|"bool":true,|};
{|"int":0,|};
{|"intlit":10000000000000000000,|};
{|"float":0.0,|};
{|"string":"string",|};
{|"list":[0,1,2],|};
{|"assoc":{"value":42}|};
"}";
]
let json_string = String.concat "" snippets
let json_string_crlf = String.concat crlf snippets
let unquoted_json = {|{foo: null}|}
let unquoted_value = `Assoc [ ("foo", `Null) ]
let json_string_newline = json_string ^ "\n"
|