<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

How to Create JSON Data in Okta Workflows

Workflows
Okta Classic Engine
Okta Identity Engine

Overview

Administrators can create JavaScript Object Notation (JSON) data in Okta Workflows using a string, the Object - Construct card, or a nested JSON object. Generating JSON data structures allows administrators to use the data in various workflow automations and Application Programming Interface (API) requests.

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Workflows

Solution

What are the steps to create and format JSON from a string in a Workflow?

Create a typed JavaScript Object Notation (JSON) data structure by reviewing the required string format and using the JSON - Parse card to parse the string from the Compose card.

  1. Review the following example JSON string to understand the required structure.
    {
      "name": "Jane",
      "description": "Standard user",
      "email": "user@example.com",
      "features": {
        "SSO": "on",
        "MFA": "on",
        "Workflows": "on"
      }
    }
  1. Use the JSON - Parse card to create a typed JSON data structure from the string in the Compose card.

Flow that creates a typed JSON data structure  


The result of running this flow is:
Result  


The JSON – Parse card returns a JSON object that is usable with other cards:
JSON objec  


It is also possible to pass data from other cards to create the JSON dynamically:
Workflow  

 

What are the steps to create and format JSON with the Object – Construct card in a Workflow?

Configure the Object - Construct card to build a JSON object by defining the required keys and values and testing the card to verify the output.

  1. Configure the Object - Construct card to build a JSON object by defining the required keys and values.

Object – Construct card

  1. Test the card to verify the resulting JSON object output.

JSON object  


Using the Object–Construct card is handy when it is needed to create headers for an API service:
Object–Construct card  


The card creates the following JSON object:

{
  "X-Favorite-Food": "Pizza",
  "X-Favorite-Drink": "Tea"
}

 

What are the steps to create and format a nested JSON object in a Workflow?

Create a nested JSON object using the Object - Construct card by setting the field name with dot notation and testing the card to generate the nested structure.

  1. Create a nested JSON object using the Object - Construct card by setting the field name with dot notation, such as user.email.

A nested JSON object

  1. Test the card to generate the nested structure.

Test the card

 

Review the resulting nested JSON output.

{
  "user": {
    "email": "user@okta.com"
  }
}

 

Related References

Loading
How to Create JSON Data in Okta Workflows | Okta Support