javascript - Access JSON Child Node via Variable - JSON2HTML -
i got following transform template:
var transform = {'<>':'li','html':'${name} - ${version} - ${licensesources.package.sources[0].license}'};
now want transform json html json2html:
var html = json2html.transform(data,transform);
json looks 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 access licensesouce.package.sources.license = "bsd" on transform variable. can't figure out notation.
can help?
thx in advance
i figured out:
${licensesources.package.sources.0.license}
Comments
Post a Comment