toTOML

Convert a JSONValue to a TOMLValue.

toTOML
(
JSONValue json
)

Throws

TOMLException if the array values have different types TOMLExcpetion if a floating point value is not finite TOMLException if the json value is null

Examples

try {
	// null
	toTOML(JSONValue.init); assert(0);
} catch(TOMLException) {}

assert(toTOML(JSONValue(true)).type == TOML_TYPE.TRUE);
assert(toTOML(JSONValue(false)) == false);
assert(toTOML(JSONValue("test")) == "test");
assert(toTOML(JSONValue(42)) == 42);
assert(toTOML(JSONValue(ulong.max)) == -1);
assert(toTOML(JSONValue(.1)) == .1);
assert(toTOML(JSONValue([1, 2, 3])) == [1, 2, 3]);
assert(toTOML(JSONValue(["a": 1, "b": 2])) == ["a": 1, "b": 2]);

Meta