JSONValue.emptyArray

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

struct JSONValue
enum emptyArray = JSONValue(JSONValue[].init);

Examples

JSONValue arr1 = JSONValue.emptyArray;
assert(arr1.type == JSONType.array);
assert(arr1.array.length == 0);
arr1.array ~= JSONValue("Hello");
assert(arr1.array.length == 1);
assert(arr1.array[0] == JSONValue("Hello"));

JSONValue arr2 = JSONValue.emptyArray;
assert(arr2.array.length == 0);
assert(arr1 != arr2);

Meta