I have gone through all above links but no solution how can I access nested arrays objects
My sample code
String data = "template-excel-002-data.json";
String fileName = "src/test/resources/input/templates/valid-excel-002.xlsx";
final WorkbookDesigner designer = new WorkbookDesigner();
designer.setWorkbook(new Workbook(fileName));
String[] smartMarkers = designer.getSmartMarkers();
System.out.println("smart marker: "+Arrays.asList(smartMarkers));
designer.setJsonDataSource("c8", testFileUtils.readJsonFile("input/data", data));
designer.process();
designer
.getWorkbook()
.save("src/main/resources/test-smart-marker-output.xlsx", SaveFormat.XLSX);
Json data
{
“node”: {
“DefaultRecipe”: {
“RecipeFoodLabelRevision”: {
“Ingredients”: [
{
“LibraryItem”: {
“BTY_Source_string”: “XXX”,
“C$Name”: “XXX”,
“BTY_Ingredient_PurposeOfUse_enumlist”: [
“XX”
],
“BTY_Ingredient_CAS1_string”: “XX”
},
“RelativeQty”: 0.878
},
{
“LibraryItem”: {
“BTY_Source_string”: “XXX”,
“C$Name”: “XX”,
“BTY_Ingredient_PurposeOfUse_enumlist”: [
“XX”
],
“BTY_Ingredient_CAS1_string”: “XX”
},
“RelativeQty”: 0.121288
},
{
“LibraryItem”: {
“BTY_Source_string”: “XX”,
“C$Name”: “XX”,
“BTY_Ingredient_PurposeOfUse_enumlist”: [
“XX”
],
“BTY_Ingredient_CAS1_string”: “XX”
},
“RelativeQty”: 0.10768799999999998
},
{
“LibraryItem”: {
“BTY_Source_string”: “XX”,
“C$Name”: “XX”,
“BTY_Ingredient_PurposeOfUse_enumlist”: [
“XXXT”
],
“BTY_Ingredient_CAS1_string”: “XX”
},
“RelativeQty”: 0.104712
}
]
}
}
}
}
template file is present in excel and smart marker tags are
1: &=c8.node.DefaultRecipe.CurrentRevision.RecipeFoodLabelRevision.Ingredients.LibraryItem.BTY_Source_string
2:
&=c8.node.DefaultRecipe.CurrentRevision.RecipeFoodLabelRevision.Ingredients.LibraryItem.BTY_Ingredient_CAS1_string
Q2: Another question is I want to access simple array of string eg. languages given in below json
Json data:
{
"node": {
"DefaultRecipe": {
"C$Name": "ROUGE DIOR INTER 2020 743",
"languages": ["English", "Arabic", "Hindi", "Urdu", "French"],
}
}
}
I tried smart markers
&=$c8.node.DefaultRecipe.languages
But no data is printing. How can I print languages ?
Q3: Is it possible to add images in base64 format in JSON data and bind those in template ?