gwp_json_get
When a JSON string is stored as a Gravity Forms Field value, the gwp_json_get
modifier decodes the JSON and returns the value specified by the provided JSON path. This enables users to dynamically extract nested information from complex JSON data structures.
{JSON String:1:gwp_json_get path= not_found=}
Settings | Info |
---|---|
path | Path to the desired value, like level1/level2/key |
not_found | What to return if the there is no result. |
How to create a path to a specific JSON value
For our API Connector Add-on we created a JSON path parse tool which outputs all the possible paths from a JSON string.
Example
Consider a Gravity Forms Text Field with label Project Data (field id 1) that has the following JSON as a value:
{
"projects": [
{
"Name": "Project Alpha",
"Status": "Active"
},
{
"Name": "Project Beta",
"Status": "Completed"
}
]
}
To extract the name of the first project:
{Project Data:1:gwp_json_get path="/projects/0/Name" not_found="No project found"}
This would return: Project Alpha