This guide provides instructions on creating JSON data in Workflows.
- Okta Workflows
This article covers three ways to create JSON data:
- Create JSON from a string.
- Create JSON with the Object – Construct card.
- Create a nested JSON object.
Create JSON from a string
If the following JSON string is given:
{
"name": "Jane",
"description": "Standard user",
"email": "jane@atko.com",
"features": {
"SSO": "on",
"MFA": "on",
"Workflows": "on"
}
}
The following will create a typed JSON data structure:
The result of running this flow is:
The JSON – Parse card returns a JSON object with other cards:
It is also possible to pass data from other cards to create the JSON data:
Create JSON with the Object – Construct card
The Object – Construct card can also be used to create a JSON object.
Testing this card results in the following JSON object:
Using the Object–Construct card is handy when it is needed to create headers for an API service:
The card creates the following JSON object:
{
"X-Favorite-Food": "Pizza",
"X-Favorite-Drink": "Tea"
}
Create a nested JSON object
A nested JSON object can also be created with the Object-Construct card. Notice that the field name is set to user.email, and uses a dot notation:
Testing the card:
JSON result:
{
"user": {
"email": "user@okta.com"
}
}
