<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Get Data from a JSON Object in Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

Building workflows requires reading values from a JSON object, such as a connector that returns JSON data or an external API endpoint that returns JSON data.
 

Okta Workflows has two cards to get values from JSON:

  • Object – Get card
  • Object – Get Multiple card
Applies To
  • Okta Workflows
Solution

This guide will use the following JSON to show how the cards work:

{
   "product": "ice cream",
   "ingredients": {
      "ingredient": [{
         "id": 100,
	     "type": "chocolate"
      },
      {
	     "id": 200,
	     "type": "vanilla"
      },
      {
         "id": 300,
	     "type": "caramel"
      }
      ]
   },
   "shop": {
      "inventory": {
         "instock": 100,
	     "ordered": 50
      }
   }
}

 

Use the Object – Get card

  • Extract a simple value

Use the Object – Get card to read a JSON value:

Reading a JSON value


Testing this card:

Extracting a simple text 

  • Extract an object
    • To extract the following object:

       

      {
         "id": 100,
         "type": "chocolate"
      }

Use the ingredients.ingredient.0 path (also called a key):

Extracting an object

    • To extract the following object:
      {
         "instock": 100,
         "ordered": 50
      }

Use the shop.inventory path:

Extracting an object value

 

  • Extract data from a list

The following example shows how to get a list item with the ingredients.ingredient.1.type path:

Extracting a value from a list

 

  • Set output type

When retrieving a JSON value, specify the correct output type.
 

Retrieving valueSet output type to
TextText
NumberNumber
ObjectObject
ListObject + List


The following shows four different value types:
 Four output data types: text, number, object, and list 


Using the Object – Get Multiple card

The Object – Get card outputs a single JSON path. The Object – Get Multiple card works similarly and outputs multiple values.

Enter multiple paths (or keys) to get values:
Using the Object – Get Multiple card 


The output type is set on the path when using the Object – Get Multiple card.


Testing the card:

Testing the Object – Get Multiple card

 


Add keys to a JSON object

How to read JSON values using the Get and Get Multiple cards has been covered.

The User Sign In Attempt event has the Event Details JSON object. To get its values, use the Get Multiple card:

Extracting JSON values with the Get Multiple card 


The Event Details JSON object contains keys/objects that the card does not expose.


Set up (expose) the keys inside the JSON object. Then, connect the values directly to another card without using the Get or Get Multiple card.

Defining keys to extract in the JSON object 

In the screenshot above, the Assign and Get Multiple cards produce the same result.


JSON utility tools

Several tools to help with working with JSON:

  • Use JSON Lint to validate and format a JSON sample.
  • Use JSONPath Online Evaluator to extract values from a JSON sample.
    • JSONPath and Okta Workflows utilize different JSON parsers on the backend. Not all examples will work identically.
Loading
Get Data from a JSON Object in Workflows