JSON Template Generator: Google Sheet for Creating Webhook Templates

GreenFlux
Participant V

Sometimes you have to map a LOT of columns from one table to another and create a really big JSON template.

I had to do a table with over 100 columns, so I built a template generator to provide a dropdown menu of columns and add all the extra characters.

Just paste in your two rows of column headers, and use the dropdown to finish generating your template.


The sheet is public, but view-only. Copy the template to your GDrive to use.

15 7 2,115
7 REPLIES 7

This is very handy. I usually do these in Notepad++ but will switch to this method. Thanks @GreenFlux

@Bellave_Jayaram
I have created a copy of this sheet under gDrive > able3ventures. FYI.

LeventK
Participant V

@GreenFlux
In your gSheet, there is a TEMPLATE sheet. Provided you place below sheet formula in [C1] cell, it will eliminate the last comma (,) in the generated payload and also eliminate the empty payload generation in blank cells:

={"Template Row";ARRAYFORMULA(IF(LEN(A2:A),IF(LEN(A3:A),""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&""""&",",""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&""""),""))}

LeventK
Participant V

@GreenFlux
It can even be re-arranged like this:


Sheet expression in [C1]


={"Template Row";ARRAYFORMULA(IF(LEN(A2:A),""""&A2:A&""""&": "&""""&"<<["&B2:B&"]>>"&"""",""))}

Sheet expression in [D1]


="{"&CHAR(10)&JOIN(","&CHAR(10),INDIRECT("C2:"&ADDRESS(ARRAYFORMULA(IFNA(MATCH(2,1/(C:C<>"")))),3,4,TRUE)))&CHAR(10)&"}"

which will produce a concatenated payload with the correct syntax

Nice touch! Thanks, @LeventK I updated the public version.

Hereโ€™s a related tip for generating a list of all columns in your app. It works well with the template in this post because you need a list to feed the dropdowns anyway.

I also created a quick way to generate a JSON string for physical columns

Might be helpful for few use cases

Top Labels in this Space