- Introduction
- Setting up the JSON file
- Main flow to get the JSON data
- Helper flow to process each item in a list
- Using the Get Multiple card
- Related content
- What you learned
- Workflows resources
Introduction
Okta Workflows how-to guides are questions and answers from the community office hours, the #okta-workflows channel on MacAdmins Slack and other places. Read all the other how-to guides.
How to extract key-pair values from a JSON payload with multiple objects?
This how-to guide is based on this forum question.
The How to Iterate Over a JSON Object (or How to Use the Object β For Each Card) guide answers the same question.
Setting up the JSON file
In this guide, you are going to work with the following JSON.
JSON file:
{
"sheets": [
{
"properties": {
"sheetId": 0,
"title": "Sheet1",
"index": 0,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 317732887,
"title": "Sheet2",
"index": 1,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 2125125274,
"title": "Sheet3",
"index": 2,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 144976084,
"title": "Sheet4",
"index": 3,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 1179906118,
"title": "Sheet5",
"index": 4,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 1615383701,
"title": "Sheet6",
"index": 5,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 561243345,
"title": "Sheet7",
"index": 6,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
}
]
}
You will likely get this JSON from an API call.
You can use the Mock API service to create an endpoint that returns the above JSON for testing.
Example API endpoint:
https://mocki.io/v1/391dd7af-a764-46d9-b0fb-1fcb3a5f9a95
If you don’t want to use an API, you can use the Compose and Parse cards to create a list of JSON objects shown in the screenshot below.

Since you are working with a list, the solution has two flows.
- A main flow to get a list of objects (JSON file)
- A helper flow to process each item and retrieve the key-pair value(s).
Main flow to get the JSON data
This is the main flow:

In this flow:
- The API Connector – Get card calls the API endpoint to get the JSON data
- In the cards Response section, the path sheets is added to the Body field. This allows directly passing the sheets field to the next card
- The sheets field is a JSON array, and its type is a list of objects

- The sheets field (JSON array) is passed to the List – For Each card
- The Get Multiple Keys_Helper helper flow is called for each item in the list (passed in the With the following values section)
Next, you are going to look at the helper flow.
Helper flow to process each item in a list
This is the helper flow:

The first card, the Helper Flow, receives each item (JSON object) that looks like this:
{
"properties": {
"sheetId": 561243345,
"title": "Sheet7",
"index": 6,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
}
Using the Get Multiple card
Next, you specify the key for the value to retrieve from the JSON object using the Get Multiple card. You can use dot notation for nested objects.

The keys and their types specified on the card are:
- properties (type Object)
- properties.title (type Text)
- properties.gridProperties (type Object)
- properties.gridProperties.rowCount (type Text)
Output from the helper flow run:

The properties JSON key is used in every get. You can define the properties key on Helper Flow card, and you will not need to use the name in the Get Multiple card.
The updated helper flow:

In the screenshot above, the properties key (type Object) is set on the Record field on the Helper Flow card. This allows passing the properties key value to subsequent cards.
The keys and their types specified on the card are:
- properties.title (type Text)
- properties.gridProperties (type Object)
- properties.gridProperties.rowCount (type Text)
Related content
The following guides will help you learn more about this topic:
- How to Read a JSON Path With Dot-Notation in Workflows
- How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)
- How to Find the JSON Object Passed From a Streaming Action to a Helper Flow in Okta Workflows
What you learned
This guide taught you how to retrieve key-value pairs from a JSON payload with multiple objects.
Workflows resources
π« Get help from Workflows specialists during weekly community office hours.
πΊ Learn from Workflows videos.
π Get help from support: discuss a Workflows topic or ask a question.
ππ»ββοΈ Join the #okta-workflows channel on MacAdmins Slack to learn and get help from the community.
Leave a comment