merge-batch2json
v1.0.0
Published
Merge BATHC variables into JSON from file
Downloads
9
Maintainers
Readme
Merge BATCH 2 JSON
Replace string in JSON using BATCH patter with BATCH file vars
Install using:
npm install merge-batch2json --save
Simple usage :
const merge = require('merge-batch2json');
var configData = await merge( __dirname + '\\myConfig.json', __dirname + '\\myVars.bat' );
The myConfig.json has the following content:
{
"connections":{
"webservice":{
"ip" :"%SERVER_IP%",
"port" :"%SERVER_PORT%"
}
}
}
myVars.bat has the following content:
@ECHO OFF
cd %~dp0
SET SERVER_IP= 127.0.0.1
SET SERVER_PORT= 1234
The result output will be:
{
"connections":{
"webservice":{
"ip" :"127.0.0.1",
"port" :"1234"
}
}
}