Using dub.json parameters in code

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 15 10:39:34 PDT 2016


On Saturday, 15 October 2016 at 17:36:10 UTC, Gustav wrote:
> Hi,
>
> I want to use the variables from dub.json. For example, use the 
> parameter "name" to display information message. Now I read 
> dub.json. Is there a way to import them?
>
> Please excuse any mistakes as English is my second language.

I don't know wether there's a dub specific API but you could use 
string imports for that:

auto dubFile = import("dub.json");
// then parse it with your favourite json lib

You have to use the -J flag for dmd to know where to find 
dub.json though.


More information about the Digitalmars-d-learn mailing list