Json

Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 11 17:26:00 PDT 2015


On Thursday, 11 June 2015 at 23:58:33 UTC, Cassio Butrico wrote:
> What does the .json file and how to use it?

In D a file with the extension *.json is used to describe packets 
that are included in your project, the dependency manager DUB.

For example, you can install Eclipse with DDT and create a 
project with DUB. The file dub.json write the following:
-----
{
     "name" : "myDupApp",
     "description" : "Carbon - Test.",
     "dependencies" : {
         "carbon": "~>1.4.1"
     }
}
-----

Save the file (Ctrl + S). Then in your project with DUB 
downloaded package `carbon`:
http://code.dlang.org/packages/carbon

After that you can safely use the package `carbon`:
-----
import std.stdio, carbon.linear;;

void main() {
     auto m = matrix!(2, 3, (i, j) => i * 3 + j);
     writeln(m); // [[0, 1, 2], [3, 4, 5]]
}


More information about the Digitalmars-d-learn mailing list