www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using dub.json parameters in code

reply Gustav <dmitry.a.balakin gmail.com> writes:
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.
Oct 15 2016
parent cym13 <cpicard openmailbox.org> writes:
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.
Oct 15 2016