Free Support Forum - aspose.com

Html templates with table & nested array json data

I am trying to create an aspose pdf using html template and json data. My Json data format is as below. Is it possible to use nested json arrays in foreach directive ? (In this example i am unable to print the data for options inside events foreach )

<!-- <table style="width: 100%;" >
    <tr> -->
        <div data_merge='{{#foreach events}}'>
            <h2>{{options}}</h2>
            <table style="width: 100%;">
                <h5 style="color:red;">
                    Please air the below rotation during {{header}} :
                </h5>
                <tr style="background-color: aqua;">
                    <th>Flight</th>
                    <th>ISCI</th>
                    <th>Title</th>
                    <th>Standard Feed/Split Feed</th>
                    <th>Length</th>
                    <th>Rotation</th>
                </tr>
                <tr>
                    <div data_merge='{{#foreach options}}'>
                    <td rowspan="{{options.NumberOf()}}">{{flightNumber}}</td>
                        <td>{{options.isci}}</td>
                        <td>{{title}}</td>
                        <td>{{feed}}</td>
                        <td>{{length}}</td>
                        <td>{{rotation}}</td>
                    </div>
                </tr>
            </table>
        </div>

and my json data is as follows:

{
	"brands": "WABC-TV, WCBS-TV, WNBC-TV, WNYW-TV, WPIX-TV, WWOR-TV",
	"createdDate": "16-01-2020",
	"events": [{
		"header": "Early Morning daypart",
		"flightNumber" : "1/6/20-2/16/20",
		"options" : [
		{"isci": "QCVB1959H", "title": "OPT ACQ Jan_2020 GM $64 2yr Non-comp AO-TV-Int 30", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "50%" },
		{"isci": "QCVB1959H", "title": "OPT ACQ Jan_2020 GM $64 2yr Non-comp AO-TV-Int 30 TFNTest", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "50%" }
		]
	},
	{
		"header": "Early News, and Late News dayparts",
		"flightNumber" : "1/6/20-2/16/20",
		"options" : [
		{"isci": "QCVB1959H", "title": "OPT ACQ Jan_2020 GM $64 2yr Non-comp AO-TV-Int 30", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "35%" },
		{"isci": "QCVB1960H", "title": "OPT ACQ Jan_2020 GM $64 2yr Non-comp AO-TV-Int 30 TFNTest", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "35%" },
		{"isci": "QCVB1961H", "title": "OPT ACQ Jan_2020 GM $39 1yr Non-comp Int 30", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "35%" },
		{"isci": "QCVB1962H", "title": "OPT ACQ Jan_2020 GM $39 1yr Non-comp Int 30 TFNTest", "feed": "Standard Feed (Non-Subs)","length" : ":30", "rotation": "35%" }
		]
	}]
}

@arjun.chandran05,

Thanks for contacting support.

Can you please share complete working sample project so that we may further investigate this on our end to help you out.