Simple HTTP docker service to render a Json template from Json data.
Templating provided by: Select Transform
Send a POST
request with a json object including a data
and template
fields.
docker run -d -p 8080:80 socialmetrix/json-template-service
Request
{
"data":{
"items":[1,2,3,100,10,19]
},
"template":{
"labels":{
"{{#each items}}":{
"type":"label",
"text":"{{this}}"
}
}
}
}
Response
{
"labels":[
{
"type":"label",
"text":1
},
{
"type":"label",
"text":2
},
{
"type":"label",
"text":3
},
{
"type":"label",
"text":100
},
{
"type":"label",
"text":10
},
{
"type":"label",
"text":19
}
]
}
https://selecttransform.github.io/site/transform.html
{
"data":"Original Content",
"template":"{{this}}"
}
{
"data":{
"items":[1,2,3,100,10,19]
},
"template":{
"labels":{
"{{#each items}}":{
"type":"label",
"text":"{{this}}"
}
}
}
}
{
"data":{
"user":{
"firstName": "Victor",
"middleName": "Ignacio",
"lastName": "Perez"
}
},
"template":{
"name": "{{user.firstName}} ({{user.firstName[0]}}.{{user.middleName[0]}}.{{user.lastName[0]}})."
}
}
{"name":"Victor (V.I.P.)"}