License:
BSD style: see license.txtVersion:
July 2008: Initial releaseAuthors:
Aaron, Kris
1 2 | auto json = new Json!(char); json.parse (`{"t": true, "n":null, "array":["world", [4, 5]]}`); |
1 | json.print ((char[] s) {Stdout(s);}); |
1 2 3 4 5 | auto json = new Json!(char); // [true, false, null, "text"] with (json) value = array (true, false, null, "text"); |
1 2 3 | // {"a" : 10} with (json) value = object (pair("a", value(10))); |
1 2 3 | // {"a" : 10, "b" : true} with (json) value = object (pair("a", value(10)), pair("b", value(true))); |
1 2 3 | // {"a" : [10, true, {"b" : null}]} with (json) value = object (pair("a", array(10, true, object(pair("b"))))); |
TODO:
document how to extract content Big thanks to dhasenan for suggesting the construction notation. We can't make effective use of operator-overloading, due to the use of struct pointers, so this syntax turned out to be the next best thing.