jsonned 1.0.2
A binding to jsonnet for Dlang
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:
jsonneD: Binding to jsonnet for the D Programming language
///
unittest {
import std.json;
JsonneD jn = JsonneD();
string s = `
{
person1: {
name: "Alice",
welcome: "Hello " + self.name + "!",
},
person2: self.person1 {
name: std.extVar("OTHER_NAME"),
},
}`;
jn.extVar("OTHER_NAME", "Robert Schadek");
auto eval = jn.evaluateSnippet("foo.json", s);
JSONValue exp = parseJSON(`
{
"person1": {
"name": "Alice",
"welcome": "Hello Alice!"
},
"person2": {
"name": "Robert Schadek",
"welcome" : "Hello Robert Schadek!"
}
}`);
assert(!eval.rslt.isNull);
JSONValue r = parseJSON(eval.rslt.get());
assert(exp == r, format("\nexp:\n%s\neva:\n%s", exp.toPrettyString(),
r.toPrettyString()));
}
///
unittest {
import std.json;
JsonneD jn = JsonneD();
auto rs = jn.evaluteFileMulti("tests/m0.jsonnnet");
assert(rs.length == 2, format("%s", rs.length));
assert(rs[0].filename == "a.json");
assert(rs[1].filename == "b.json");
}
///
unittest {
import std.json;
string s = `
{
"a.json": {
x: 1,
y: $["b.json"].y,
},
"b.json": {
x: $["a.json"].x,
y: 2,
},
}
`;
JsonneD jn = JsonneD();
auto rs = jn.evaluteSnippetMulti("foo.json", s);
assert(rs.length == 2, format("%s", rs.length));
assert(rs[0].filename == "a.json");
assert(rs[1].filename == "b.json");
}
Documentation
The Documentation is still WIP, please have a look at the vibe.d project in the test folder.
Contributing
PRs are welcome!
About Kaleidic Associates
We are a boutique consultancy that advises a small number of hedge fund clients. We are not accepting new clients currently, but if you are interested in working either remotely or locally in London or Hong Kong, and if you are a talented hacker with a moral compass who aspires to excellence then feel free to drop me a line: laeeth at kaleidic.io
We work with our partner Symmetry Investments, and some background on the firm can be found here:
http://symmetryinvestments.com/about-us/
- Registered by Robert Schadek
- 1.0.2 released 5 years ago
- symmetryinvestments/jsonneD
- LGPL3
- Copyright © 2019, Symmetry Investments
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.3 2019-Oct-11 1.0.2 2019-Oct-11 1.0.1 2019-Oct-11 1.0.0 2019-Oct-03 ~master 2019-Oct-11 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
19 downloads total
-
- Score:
- 1.4
- Short URL:
- jsonned.dub.pm