toml 0.4.0-rc.3
D implementation of TOML
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
D implementation of Tom's Obvious, Minimal Language version 0.4.0
Usage
dub.json: "toml": "~>0.4.0-rc.2"
dub.sdl: dependency "toml" version="~>0.4.0-rc.2"
import toml;
TOMLDocument doc;
doc = parseTOML("example = 1");
assert(doc["example"].integer == 1);
doc = parseTOML(`
bool = true
integer = 42
floating = 1e2
string = "string"
`)
assert(doc["bool"] == true);
assert(doc["integer"] == 42);
assert(doc["floating"] == 1e2);
assert(doc["string"] == "string");
// from a file
import std.file : read;
doc = parseTOML(cast(string)read("/path/to/file.toml"));
Conversion
JSON
dub.json: "toml:json": "~>0.4.0-rc.2"
dub.sdl: dependency "toml:json" version="~>0.4.0-rc.2"
import std.json;
import toml;
import toml.json;
auto json = JSONValue([1, 2, 3]);
assert(toTOML(json).type == TOML_TYPE.ARRAY);
assert(toTOML(json) == [1, 2, 3]);
auto toml = parseTOML(`key = "value"`);
assert(toJSON(toml).type == JSON_TYPE.OBJECT);
assert(toJSON(toml) == JSONValue(["key": "value"]));
Missing features
- Nested array of tables
- Registered by Kripth
- 0.4.0-rc.3 released 7 years ago
- dlang-community/toml
- MIT
- Authors:
- Sub packages:
- toml:json
- Dependencies:
- none
- Versions:
-
2.0.1 2022-Nov-30 2.0.0 2022-Nov-30 1.0.0 2021-Aug-11 1.0.0-rc.3 2018-Sep-04 1.0.0-rc.2 2018-Feb-16 - Download Stats:
-
-
1 downloads today
-
1 downloads this week
-
4 downloads this month
-
3652 downloads total
-
- Score:
- 1.3
- Short URL:
- toml.dub.pm