json-ref-simple
v1.0.0
Published
JSON with Reference
Downloads
5
Readme
json-ref
JSON with Reference
Example
const deref = require('json-ref').deref;
const config = {
"base": "https://domain.com/dir",
"config": "{$.base}/project.json",
"images": {
"img1": "{$.base}/img1.png",
"img2": "{$.base}/img2.png"
},
"props": {
"button/background": {
"url": "{$.images.img1}"
}
}
};
console.log(deref(config));
will output
{
"base": "https://domain.com/dir",
"config": "https://domain.com/dir/project.json",
"images": {
"img1": "https://domain.com/dir/img1.png",
"img2": "https://domain.com/dir/img2.png"
},
"props": {
"button/background": {
"url": "https://domain.com/dir/img1.png"
}
}
}