Populate HTML Templates with JSON and XML Data in C#

Of all the miracles Po had seen in the time and space of its death, Po thought this–the absorption of another, the carrying of it–was the most bewildering and remarkable of all.

– Lauren Oliver, Liesl & Po

Many great things in the world are the result of merging. Nature, animals, people, and technology merge together to produce unmatchable results.

At Aspose we merge templates to produce robust documents. HTML is the standard markup language for creating web pages and XML and JSON are data sources for storing and transporting user data. By merging HTML with the user data source, you can get highly effective dynamic HTML documents.

Using Aspose.HTML for .NET you can create HTML Templates and Merge them with data sources using ConvertTemplate method in a single line of code.

ConvertTemplate(HTMLDocument, TemplateData, TemplateLoadOptions, outputPath)

HTML Template

You can create a simple HTML template for working with user data:


For the given HTML template you can have the following JSON data:


By merging the given JSON and HTML using Aspose.HTML for .NET, you’ll have the following resultant HTML file:

For further details about template merging using Aspose.HTML for .NET, please feel free to visit this documentation article.