json2json - Transform JSON format
Transform a JSON input to another JSON format using a template.
templateJson
object
Template to be filled with data.
Example:
{
"creationDate": "{{info.created_at}}",
"creator": {
"name": "{{info.created_by}}"
},
"people": [
"{{staff.developers}}",
{
"firstName": "{{name}}",
"city": "{{address.city}}",
"likes": "{{hobbies}}",
"hobbies": "=> join(hobbies,' & ')",
"age": "=> toNumber(age)",
"isAdmin": "=> toBoolean(isAdmin)"
}
]
}
templateJsonString
string
Stringified template to be filled with data. For expressions you can use the following syntaxes: {{ name }} and { { name } }.
Example:
{"creationDate":"{{info.created_at}}","creator":{"name":"{{info.created_by}}"},"people":["{{staff.developers}}",{"firstName":"{{name}}","city":"{{address.city}}","likes":"{{hobbies}}","hobbies":"=> join(hobbies,' & ')","age":"=> toNumber(age)","isAdmin":"=> toBoolean(isAdmin)"}]}
inputJson
object
JSON with data
Example:
{
"info": {
"created_at": "01.01.2023",
"created_by": "1001fx Admin"
},
"staff": {
"developers": [
{
"name": "Rob",
"address": {
"city": "London"
},
"hobbies": [
"cycling",
"hifi"
],
"age": "22",
"isAdmin": "true"
},
{
"name": "Chris",
"address": {
"city": "Oxford"
},
"hobbies": [
"hill walking"
]
}
]
}
}
inputJsonString
string
Stringified JSON with data
Example:
{"info":{"created_at":"01.01.2023","created_by":"1001fx Admin"},"staff":{"developers":[{"name":"Rob","address":{"city":"London"},"hobbies":["cycling","hifi"],"age":"22","isAdmin":"true"},{"name":"Chris","address":{"city":"Oxford"},"hobbies":["hill walking"]}]}}