Load JSON from multiple files
Via npm on Node:
npm install loadjsons
Reference in your program:
var lj = require('loadjsons');
// Load project.json from current directory
var json = lj.load('project');
The elements of the JSON file to load can be strings with reference to other JSON files, relative to the parent
file being loaded. The reference starts with $
.
Example. Parent file:
{
"project": "$simple",
"author": "adam"
}
simple.json
in the same directory:
{
"title": "Simple JSON"
}
Result:
{
"project": {
"title": "Simple JSON"
},
"author": "adam"
}
To escape the initial $
use \
:
{
"project": "\\$simple",
"author": "adam"
}
TBD
git clone git://github.com/ajlopez/LoadJsons.git
cd LoadJsons
npm install
npm test
TBD
0.0.1 Published
MIT
Feel free to file issues and submit pull requests — contributions are welcome<
If you submit a pull request, please be sure to add or update corresponding
test cases, and ensure that npm test
continues to pass.