In this guide:
Okta Workflows guides
Okta Workflows guides are questions and answers from the community office hours, the #okta-workflows channel on MacAdmins Slack, and other places. Read all the other guides.
How do you create and validate JSON input in Okta Workflows?
This guide will teach you how to create and validate JSON input in Okta Workflows.
Validate JSON input
This guide focuses on validation. Read the How to Create JSON Data in Okta Workflows guide to learn how to create JSON data.
If you are building a flow (or cards) where JSON is an input (such as the Slack Block UI or Microsoft Teams message), it is recommended that you use the Object â Construct (or ListâConstruct) cards instead of the TextâCompose card.
You want to validate the following JSON before using it in an API request:
{
"subject": "đ¨ User Activated",
"body": {
"contentType": "html",
"content": "<b>Sara August</b> (<u>asara</u>), <i>President</i>."
}
}
Validating this JSON is a good idea since a missing bracket (or similar) can cause the API request to fail.
Use the Object â Construct card
The ObjectâConstruct card can create a valid JSON object.. Note that you can create nested keys, such as body.content.

Testing the Object â Construct card produces the following valid JSON object:

If your block fields are populated by user input of any kind, someone can input JSON and alter the JSON schema itself. This usually breaks the JSON, but it can also change the blocks entirely. Unlike the TextâCompose card, the construct cards will correctly sanitize and validate inputs.
The following flow uses ObjectâConstruct and TextâCompose cards to create a JSON object. At the end, the JSONâParse card validates the JSON from the Compose card.

The following flow runs with three text inputs (Sara August, asara, and President):

The next run shows entering {“Title”:”President”} for the Title input. The ObjectâConstruct card creates a valid JSON, while the Text – Compose card doesn’t create a valid JSON.

Use the JSONâParse card
If you work with a lot of JSON data, you can use the JSONâParse card to validate it.
The following is an example of validating JSON using the JSONâParse card before sending an API request.

If the JSON is invalid (missing a comma after the User Activated value), you will see the following error:

Related Okta Workflows guides
Okta Workflows resources
đŤ Get help from Workflows specialists during weekly community office hours.
đş Learn from Workflows videos.
đ Ask questions and share your flows on the Okta Workflows community forum.
đđťââď¸ Get help from the community: join the #okta-workflows channel on MacAdmins Slack.
Leave a comment