i got the following transform template:
var transform = {'<>':'li','html':'${name} - ${version} - ${licenseSources.package.sources[0].license}'};
now i want to transform a JSON into a HTML with json2html:
var html = json2html.transform(data,transform);
JSON looks like this:
{
"id": "xxx",
"name": "xxx",
"version": "0.0.14-SNAPSHOT",
"repository": "xxx",
"directory": "./",
"type": "(none)",
"licenseSources": {
"package": {
"sources": [{
"license": "BSD",
"url": "(none)"
}
]
},
"license": {
"sources": [{
"filePath": "xxx",
"text": "xxx"
}, {
"filePath": "xxx",
"text": "xxx"
}
]
},
"readme": {
"sources": [{
"filePath": "xxx",
"text": "xxx"
}
]
}
}
}
I want to access licenseSouce.package.sources.license = "bsd" over the transform variable. But i can't figure out the notation.
Can someone help?
Thx in advance
I figured it out:
${licenseSources.package.sources.0.license}