In this article

TL;DR: EDocGen populates JSON data — from CRMs, databases, or APIs — into your existing Word templates to auto-generate DOCX, PDF, or HTML documents. No JSON reformatting needed. Use existing templates and and generate via UI or REST API. Supports tables, images, conditional content, calculations, multi-lingual output, and nesting up to 8 levels deep.

JSON Population into Word Template

JSON because of its lightweight is fast becoming the de-facto standard for data interchange replacing fatty XML. Hence it is often used for serializing and transmitting structured data over a network.

Almost all databases including traditional databases - Oracle, MySQL, SQL Server, and document databases such as MongoDB allow you to export data in JSON format. Merging JSON data into templates for producing various business documents greatly enhances the organization’s efficiency.

Let’s take the case of sales operations. Sales teams fill templates manually with CRM data to create proposals and after-sales documents. Exporting CRM data as JSON and auto-populating templates with it saves the sales team from tedious, expensive, and error-prone manual document creation tasks. Such automation benefits every department of the organization including legal, finance, and marketing. Moreover, business users can auto-generate documents on-demand without seeking IT support.

Start JSON to WORD Population

Why EDocGen for JSON to Word

If you are looking for a DIY system to generate documents from JSON data then possibly EDocGen is the only solution. With an intuitive interface, you can map the template's dynamic fields to JSON fields, thus controlling the data you wish to show on your document.

JSON to Word

Through API and UI, you can populate JSON into Word templates to create PDF and Microsoft Word files.

It supports the dynamic population of text, tables, content blocks, hyperlinks, and images from JSON data. It also supports multi-lingual templates, conditional statements (if-else), and calculations.

EDocGen is the perfect solution to auto-fill your existing Word templates with JSON data.

Ease of Template creation: Business users can use existing document templates to auto-generate documents. It doesn't force users to switch to the system's templates/formats. Business users can use their existing Microsoft Word templates and populate them with JSON data to generate documents. The system preserves the formatting, fonts, headers, footers, and layout exactly.

Use JSON data as-is: You can populate the JSON data as-is without any data transformation. In the mapper screen (field map), map JSON data to dynamic fields. On this screen, all dynamic fields in your document template get listed along with dropdowns of JSON keys. All you need to do is select the appropriate JSON key for each dynamic template field.

Top-notch performance: Generate thousands of documents in a few seconds.

Advanced Features

Password Protection

Set a password on the generated DOCX or PDF at generation time. The password can be automatically emailed to the recipient alongside the document attachment.

Images

Populate company logos, product images, or signatures dynamically. Supported formats: URL, Base64 string, or uploaded file ID. Image dimensions are optional and auto-resize on population.

Hyperlinks

Use {~FieldName} to generate dynamic hyperlinks in Word documents. For example, {~Email} creates a clickable mailto link from the JSON Email value.

Paragraphs / Content Blocks

Dynamically include or exclude entire paragraphs based on conditions — useful for terms and conditions sections, language-specific content, or tier-based proposal inclusions.

Graphs and Charts

Generate bar, pie, and line charts directly in Word from JSON data — useful for performance reports, financial summaries, and executive briefings.

JSON Charts and Graphs

HTML Styling

Inject HTML-formatted content into Word documents — enabling rich text, colored tables, inline styles, and page breaks from JSON string values.

The following sections describe how to convert JSON to Word using EDocGen.

There are two ways to populate JSON files to MSWord templates - Through App UI and API.

Scenario

In the example below, a sales team generates client proposals to send to prospects. Proposal details — client name, contact, line-item services, totals, and terms — are exported from the CRM as a JSON file. The JSON is populated into a standard Word proposal template to produce individually addressed, print-ready DOCX files. Some proposals require automatic subtotal and total calculations. The system then auto-emails the generated Word documents to the respective prospects, and syncs them to cloud storage for version control.

EDocGen eliminates the manual effort of copy-pasting CRM data into Word templates — saving hours per rep per week and eliminating formatting errors.

Sample JSON and Template Section

Below are the sample proposal template and the JSON array that will be populated into it.

JSON to Word Proposal Template
[
			  {
				"Proposal_Number": "PROP-2024-0081",
				"Proposal_Date": "15-08-2024",
				"Valid_Until": "15-09-2024",
				"Sales_Rep": "Jane Smith",
				"Company_Name": "Acme Technologies",
				"Contact_Person": "John Doe",
				"Address": "101 Silicon Avenue, Austin, Texas",
				"Email": "[email protected]",
				"Logo": "614aeef71ba09917fc7f6155",
				"Intro_Language": "English",
				"STH": [
				  {
					"Col1": "Service Description",
					"Col2": "Qty",
					"Col3": "Unit Price",
					"Col4": "Amount"
				  }
				],
				"ST": [
				  {
					"Service_Description": "Enterprise License — Year 1",
					"Qty": "1",
					"Unit_Price": "12,000",
					"Amount": "12,000"
				  },
				  {
					"Service_Description": "Implementation & Onboarding",
					"Qty": "1",
					"Unit_Price": "4,500",
					"Amount": "4,500"
				  }
				],
				"Payment_Terms": "Net 30",
				"Notes": "Volume discount applied for multi-year commitment."
			  },
			  {
				"Proposal_Number": "PROP-2024-0082",
				"Proposal_Date": "15-08-2024",
				"Valid_Until": "15-09-2024",
				"Sales_Rep": "Mark Rivera",
				"Company_Name": "Bright Solutions Ltd",
				"Contact_Person": "Sarah Lin",
				"Address": "22 Cloud Street, Seattle, Washington",
				"Email": "[email protected]",
				"Logo": "614aeef71ba09917fc7f6156",
				"Intro_Language": "English",
				"STH": [
				  {
					"Col1": "Service Description",
					"Col2": "Qty",
					"Col3": "Unit Price",
					"Col4": "Amount"
				  }
				],
				"ST": [
				  {
					"Service_Description": "Starter License — Year 1",
					"Qty": "5",
					"Unit_Price": "2,400",
					"Amount": "12,000"
				  },
				  {
					"Service_Description": "API Integration Support",
					"Qty": "10",
					"Unit_Price": "150",
					"Amount": "1,500"
				  },
				  {
					"Service_Description": "Training Sessions",
					"Qty": "3",
					"Unit_Price": "500",
					"Amount": "1,500"
				  }
				],
				"Payment_Terms": "Net 15",
				"Notes": "Training sessions to be scheduled within 60 days of contract signing."
			  }
			]
			

Dynamic Tags — Add to Template

The Word template uses dynamic tags to mark fields that should be replaced or looped over.

Text fields: {Proposal_Number} and {Proposal_Date} are dynamic text fields. Any word in {} is treated as a dynamic text field that gets replaced with the matching JSON value.

Table (loop): The services table (ST) loops over all line items. The table starts with {#ST} in the first column and ends with {/ST} in the last column. Column fields such as {Service_Description}, {Qty}, {Unit_Price}, and {Amount} are plain text tags inside the loop. The system iterates over the JSON array to populate each row.

The table header row uses a separate non-looping array (STH) — useful when the header itself contains dynamic column labels driven by JSON.

Image: {%Logo} populates the company logo. The JSON value can be a URL, a Base64 string, or an uploaded file ID from EDocGen's storage. Optionally, image dimensions can be appended: {%Logo:100:50} (width × height in pixels).

Conditional block (if-else):

{#Intro_Language == "English"}
			  Thank you for considering our proposal...
			{/Intro_Language}
			

This displays language-specific introduction paragraphs from a single master template — ideal for multi-language proposals across different regions.

Calculation (summation + formatting):

{ST | summation:'Amount' | format_number: ","}
			

Calculates the sum of all Amount values in the services table and formats the result with comma separators.

Tag hygiene tips:

  1. Close all loop tags properly — every {#tableName} must have a matching {/tableName}.
  2. Avoid spaces or special characters inside tag names.
  3. Name template tags to match JSON keys exactly to skip the manual mapper screen.

 How To - JSON file to Word Document Generation

Step1:

The first step is to convert the existing template into EDocGen ready template. Add the relevant dynamic tags for the fields you would like to replace with JSON data. The system uses these tags to identify the dynamic sections of the template. It supports the dynamic population of text, tables, images, text areas, hyperlinks, and content blocks. After adding tags, upload the template into EDocGen.

Step 2:

Against the document template, click the “Generate” button and select the option “generate documents from JSON". Then upload JSON and map JSON fields to the template's dynamic fields. Click the generate button to create documents in Word or PDF formats.


JSON format template

Step 3:

Choose the file format (Word/PDF/HTML/Image) of generated documents, and provide a name for the file. You can optionally add a prefix for easy identification of individual documents. Click the generate button to create documents.

Step4(Optional):

This is an optional step. Distribute the generated documents through various channels including e-Sign, Email, Cloud Storage, print, etc. The system offers out-of-box integrations with various 3rd party systems for automating document business processes.

Optimization

As you can see, no JSON data transformation is required for JSON to doc files creation. You can use any JSON file format and populate that into the template, using the mapping screen. If you use the same JSON format multiple times, mapping it every time is time-consuming particularly if your template has a large number of dynamic fields.

By naming the template's dynamic fields in line with the JSON keys, you can skip the mapping screen and auto-fill data.

Please refer to the working example for a detailed account of how to go about JSON to DOCX template population.

Additional Example — 2-Level JSON with Lists

Below is a 2-level JSON population example. The template uses a loop inside a loop to produce a section for each service package, with dynamic bullet lists for features and exclusions.

Template tags (excerpt):

{#Packages}
			  {Package_Name}
			  Features:
			  {#Features} {.} {/}

			  Exclusions:
			  {#Exclusions} {.} {/}
{/}
			

JSON:

[{
			  "Packages": [
				{
				  "Package_Name": "Starter",
				  "Features": [
					"Up to 5 users",
					"Email support",
					"Monthly reports"
				  ],
				  "Exclusions": [
					"API access",
					"Dedicated account manager"
				  ]
				},
				{
				  "Package_Name": "Enterprise",
				  "Features": [
					"Unlimited users",
					"24/7 priority support",
					"Custom integrations",
					"Dedicated account manager"
				  ],
				  "Exclusions": []
				}
			  ]
			}]
			

{.} renders each array element as a bullet point inside the loop. This pattern works for any repeating list — feature lists, clause lists, appendix items, etc.

The system supports population of JSON files up to 8 levels deep, enabling nested tables and lists inside Word documents:

H1

H2

H3

H4

{#table1}{#table2}{#table3}{#table4}{t41}

{t42}

{t43}

{t44}{/}{/}{/}{/}

The corresponding JSON for this table population is


    [{
	"table1": [{
		"table2": [{
			"table3": [{
				"table4": [{
					"t41": "t41data",
					"t42": "t42data",
					"t43": "t43data",
					"t44": "t44data"
				}]
			}]
		}]
	}]
}]

API - JSON file to Word Document Generation

It is API-first product. Use the REST API to integrate JSON-to-Word generation directly into your application, CRM, or workflow automation.

Sample cURL:

curl -X POST "https://app.edocgen.com/api/v1/document/generate" \
  -H "accept: application/json" \
  -H "x-access-token: <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "documentId": "632c2fc09e055e5d826bef2d",
    "markers": {
      "Proposal_Number": "PROP-2024-0081",
      "Company_Name": "Acme Technologies"
    },
    "format": "docx",
    "outputFileName": "acme-proposal-2024"
  }'

You can pass a JSON string directly — useful for real-time, on-demand generation triggered by user actions. Upload a JSON file containing thousands of records to trigger automated, high-volume batch generation in one go.

Through API, you can let your online users generate documents on the fly and distribute them through multiple channels. For example,

  1. Your employees can download their resumes.
  2. Insurers can generate letters and send them to the printer in PCL5 or PostScript format.
  3. Banks can offer real-time statement downloads.
  4. Send letters or acknowledgments for a user action

The system offers integrations with Office 365, SharePoint, and OneDrive. Thus you can generate Word documents with JSON data from Power Platform. It also has out-of-box integrations with several databases and CRM systems.


EDocGen is the simplest and fastest solution to convert JSON file to Word, through API or UI. Moreover, it supports multi-lingual templates, conditional statements (if-else), and calculations. For example, you can populate JSON data in French, Japanese, Spanish, etc. to generate multi-lingual documents. Register and start populating your JSON data into a Word template.

Frequently Asked Questions

Do I need to reformat or transform my JSON before using it?

No. EDocGen populates JSON as-is. You map JSON keys to template fields once in the mapper screen, or name your template tags to match JSON keys exactly to skip mapping entirely.

Can I use my existing Word templates, or do I have to rebuild them in EDocGen's format?

You can use your existing .docx templates. Add dynamic tags (e.g., {FieldName}) to mark the fields to populate — formatting, fonts, headers, footers, and layout are preserved as-is.

Can EDocGen calculate totals from JSON table data?

Yes. Use {ST | summation:'Amount' | format_number: ","} to sum a column across a looped table and format it with comma separators, directly in the template — no pre-calculation in the JSON required.

How deeply nested can the JSON structure be?

Up to 8 levels deep, supporting nested tables and lists inside a single Word document (e.g., loop-inside-loop structures like packages → features → exclusions).

Does it support conditional content based on JSON values?

Yes, via if-else blocks: {#Field == "Value"} ... {/Field}. This is commonly used for language-specific paragraphs or tier-based content from a single master template.

Can I generate documents through an API instead of the UI?

Yes. EDocGen is API-first — POST a JSON payload with template ID and field markers to /api/v1/document/generate, and get back a DOCX or PDF. Supports both single on-demand generation and batch generation from a JSON file with thousands of records.

What output formats are supported?

Word (DOCX), PDF, HTML, and Image.

Can generated documents be password-protected or auto-distributed?

Yes. You can set a password on the generated file (auto-emailed to the recipient with the document), and distribute via e-Sign, email, cloud storage, or print through built-in integrations.

Found what you’re looking for?

Start generating the documents with us.

Book a demo