Gravity Forms Customization: Changing JSON Array Keys

We need help with implementing a Gravity Forms customization to change array keys from the numeric field IDs to the Admin Field label when posting JSON via webhook. For testing, we set up a form called LLC Formation at https://www.fortenberrylaw.com/dev-form/. We are currently posting the data to a webhook testing tool to view the JSON array. Here is the URL for the webhook testing tool:

http://webhook.site/#!/c9d0775c-99f8-4066-8433-7343e7f214bb/21615a7e-22c0-4a19-b16f-7f3771c832f9/1

Gravity Forms submits data to endpoints in JSON format in name/value pairs using the numeric Field IDs for the name. For example, if the user enters “John” as his first name in the form, the resulting JSON may be as follows:

“3.3”: “John”

Gravity Forms also supports the use of an Admin Field Label (adminLabel) that can be used to reference the fields from within the Gravity Forms interface. If an Admin Field Label is not used, Gravity Forms uses the regular Field Label to reference the field.

We need to customize Gravity Forms to use the Admin Field Label instead of the Field ID to store the JSON values. In the above example, the value should be stored as:

“first_name”: “John”

This can be accomplished using Gravity Form’s pre submission filter to dynamically substitute the Admin Field Label for the Field ID or, if no Admin Field label is entered, to substitute the Field Label for the Field ID. WebMerge describes a similar process here:

https://www.webmerge.me/blog/populate-a-living-will-from-gravity-forms

The following link may also be instructive: https://stevegrunwell.com/blog/custom-field-ids-gravity-forms/

1 Like

Hello @jfortenberry - the Gravity Flow Outgoing Webhook raw body setting will handle this

https://docs.gravityflow.io/article/114-the-outgoing-webhook-step