Skip to content
Gallery
Export to Word Pro User Guide
Share
Explore
Setup Guide

icon picker
JSON Helper Formulas

There are two JSON helper formulas in this pack: JSONify() and ListToText().
JSONify(key1, value1, key2, value2, ...) takes in any number of key-value pairs as parameters and returns a JSON string which can then be passed into GenerateDocFromJSON().
The values passed into JSONify() must be strings (text), so if you need to pass in an array (list), you must first turn it into a string using ListToText([item1, item2, item3, ...]). The list to be passed into the ListToText() formula could be an entire column, a cell containing a multi-select list, or a manually generated list using list(item1, item2, item3, ...).

Example

If we wanted to fill out a template that included placeholder tags for {firstName} and {lastName} and loop tags for {hobbies} and {siblings}, we can set up a tables like the two below containing the data we need as inputs (First Name, Last Name, Hobbies, and Siblings). Since all of the values passed into JSONify() must be text, we can add a helper column to the Siblings table to generate the JSON for each sibling, and two helper text columns (Hobbies Text and Siblings Text) in Top-Level Data to turn the lists into text. Then, we can combine it all in the JSON column in Top-Level Data by passing in the text helper columns for each loop tag.
The final JSON we have generated could be used in a template such as .
Top-Level Data
JSON
First Name
Last Name
Hobbies
Hobbies Text
Siblings
Siblings Text
1
{"firstName":"Tom","lastName":"Miller","hobbies":["Golf","Chess"],"siblings":[{"name":"Jerry","age":12}]}
Tom
Miller
Golf
Chess
["Golf","Chess"]
Jerry
[{"name":"Jerry","age":12}]
2
{"firstName":"Jackie","lastName":"Smith","hobbies":["Chess","Painting","Tennis"],"siblings":[{"name":"Kim","age":13},{"name":"Olivia","age":9}]}
Jackie
Smith
Chess
Painting
Tennis
["Chess","Painting","Tennis"]
Kim
Olivia
[{"name":"Kim","age":13},{"name":"Olivia","age":9}]
3
{"firstName":"Jillian","lastName":"Thompson","hobbies":["Swimming","Tennis"],"siblings":[{"name":"Jared","age":5},{"name":"Carl","age":17}]}
Jillian
Thompson
Swimming
Tennis
["Swimming","Tennis"]
Jared
Carl
[{"name":"Jared","age":5},{"name":"Carl","age":17}]
There are no rows in this table
Siblings
Name
Age
JSON
1
Jerry
12
{"name":"Jerry","age":12}
2
Kim
13
{"name":"Kim","age":13}
3
Olivia
9
{"name":"Olivia","age":9}
4
Jared
5
{"name":"Jared","age":5}
5
Carl
17
{"name":"Carl","age":17}
There are no rows in this table

Example Template

word
My name is {firstName} {lastName}.

I have the following hobbies:
{#hobbies}
- {.}
{/hobbies}

My siblings names and ages are:
{#siblings}
1. {name}: {age}
{/siblings}
*Note: the {.} notation can be used if only one value needs to be used in each loop (like in hobbies)
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.