valid-json-template

0.2.0 • Public • Published

valid-json-template

yeah, because json-template was taken

Deps Version Downloads Circle CI

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

changelog

Package Sidebar

Install

npm i valid-json-template

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • fgribreau