Generate documents from JSON data

Help Center

Generating documents from JSON data is a powerful feature offered by DocuGenerate. This option allows you to use complex data structures, multiple data items, and nested data to create your documents. JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate.

To get started with generating documents from JSON data, click on the New document button. This button is represented by a plus sign icon:

New document button

Then for the Data source select JSON data. The other options you will see are Fill out a form and Excel or CSV file.

JSON data source

After clicking Continue, you’ll land on the Data items section. In this section, you are required to input a JSON array of objects, with each object representing a separate data item.

To aid in this process, the input field will be pre-filled with an example of a JSON object. This JSON object will have keys corresponding to the merge tags in your template. For instance, if your template has merge tags [Name], [Job Title], [Company Name], [Street Address], [City], [State], [Zip Code], [Email] and [Phone], the pre-filled JSON might look something like this:

JSON empty data structure

You can replace this example with your own JSON data. Remember, each key in your JSON objects should correspond to a merge tag in your template. For example, this is how a JSON array with 2 objects would look for this set of merge tags:

JSON data input

Once you’ve entered your data, click on Continue with N items, where N is the number of objects in your JSON array. DocuGenerate will parse the JSON data and, for each object, it will generate a separate document. The merge tags in your template will be replaced with the corresponding values from each JSON object during this process.

This method is particularly useful when you need to generate documents based on complex or large data sets.