JSONValue.emptyObject

An enum value that can be used to obtain a JSONValue representing an empty JSON object.

struct JSONValue
enum emptyObject = JSONValue(string[string].init);

Examples

JSONValue obj1 = JSONValue.emptyObject;
assert(obj1.type == JSONType.object);
obj1.object["a"] = JSONValue(1);
assert(obj1.object["a"] == JSONValue(1));

JSONValue obj2 = JSONValue.emptyObject;
assert("a" !in obj2.object);
obj2.object["b"] = JSONValue(5);
assert(obj1 != obj2);

Meta