Strategy in which to sort object-type JSON keys when we format/serialise the stored storage to string.
Loads JSON from disk.
Initialises and clears the JSONValue, preparing it for object storage.
Saves the JSON storage to disk. Formatting is done as specified by the passed KeyOrderStrategy argument.
Formats an object-type JSON storage into an output range sink.
Formats an object-type JSON storage into an output range sink.
The underlying JSONValue storage of this JSONStorage.
JSONStorage s; s.reset(); // not always necessary s.storage["foo"] = null; // JSONValue quirk s.storage["foo"]["abc"] = JSONValue(42); s.storage["foo"]["def"] = JSONValue(3.14f); s.storage["foo"]["ghi"] = JSONValue([ "bar", "baz", "qux" ]); s.storage["bar"] = JSONValue("asdf"); assert(s.storage.length == 2);
import std.conv : text; import std.json : JSONValue; JSONStorage s; s.reset(); s.storage["key"] = null; s.storage["key"]["subkey1"] = "abc"; s.storage["key"]["subkey2"] = "def"; s.storage["key"]["subkey3"] = "ghi"; assert((s.storage["key"].object.length == 3), s.storage["key"].object.length.text); s.storage["foo"] = null; s.storage["foo"]["arr"] = JSONValue([ "blah "]); s.storage["foo"]["arr"].array ~= JSONValue("bluh"); assert((s.storage["foo"]["arr"].array.length == 2), s.storage["foo"]["arr"].array.length.text);
A wrapped JSONValue with helper functions.