valid-json-template
v0.2.0
Published
Use a (valid) JSON as a template that produce another valid JSON as a result
Downloads
8
Readme
valid-json-template
yeah, because json-template
was taken
Why
Because sometimes you have a template like this that needs to be a valid JSON:
var myTemplate = `{
"user": {
"age": "{{ age.computed }}",
"biography": "{{ biography }}",
"hasBlueEyes": "{{ eyes.areBlue }}",
}
}`;
with a dataset like this:
{
"biography": "Hello world, 42.",
"age":{
"computed": 25
},
"eyes":{
"areBlue": true
}
}
and you want this:
{
"user": {
"age": 25,
"biography": "Hello world, 42.",
"hasBlueEyes": true
}
}
npm
npm install valid-json-template -S