ExtractJsonObject parses JSON text into an object that later commands and expressions can inspect.
Use it after an API call when the response body contains JSON, or against a string variable that already holds JSON text.
{
"ExtractJsonObject": {
"JsonObjectName": "SystemResponse",
"Name": "UserResponseJson",
"ContainsSecret": false
}
}| Name | Type | Required? | Description |
|---|---|---|---|
JsonObjectName |
String | Yes | Source variable. This can be a response object or a string variable containing JSON text. |
Name |
String | Yes | Variable name for the parsed JSON object. |
ContainsSecret |
Boolean | No | Masks the stored JSON object in logs. Default is false. |
After parsing, expressions can inspect the object directly.
{ "SetItem": { "Name": "UserId", "Value": "%{ GetUserResponseJson.id }%" } }
{ "Return": { "Value": "%{ ParsedUsers[0].id }%" } }
{ "Condition": { "If": "User.name.Value == AccountUserName" } }From samples/http/wordpress/WordPressHttp.json:
{
"SetItem": { "Name": "ParsedUsers", "Value": "" }
}
{
"ExtractJsonObject": {
"JsonObjectName": "SystemUsers",
"Name": "ParsedUsers"
}
}
{
"ForEach": {
"CollectionName": "ParsedUsers",
"ElementName": "User",
"Body": {
"Do": [
{
"Condition": {
"If": "User.name.Value == AccountUserName"
}
}
]
}
}
}From samples/http/okta-discovery/Okta_WithDiscoveryAndGroupMembershipRestore.json:
{
"ExtractJsonObject": {
"JsonObjectName": "SystemResponse",
"Name": "GetUserResponseJson"
}
}
{
"Condition": {
"If": "SystemResponse.StatusCode == 200",
"Then": {
"Do": [
{ "Return": { "Value": "%{GetUserResponseJson.id}%" } }
]
}
}
}From samples/http/forgerock-openam/Forgerock_OpenAM.json:
{
"Request": {
"RequestObjectName": "SystemRequest",
"ResponseObjectName": "SystemResponse",
"Verb": "POST",
"Url": "%url%",
"SubstitutionInUrl": true,
"IgnoreServerCertAuthentication": "%SkipServerCertValidation%",
"Content": {
"ContentType": "application/json"
}
}
}
{
"ExtractJsonObject": {
"JsonObjectName": "SystemResponse",
"Name": "AuthResponseJson"
}
}When
JsonObjectNamepoints to a response object, the response content type must beapplication/json. If the endpoint returns another content type, parse the raw string yourself first.
ExtractJsonObjectalso accepts a plain string variable, which is useful when JSON text is built or cleaned up before parsing.
Parsed JSON values are typically accessed with
%{ Object.Property }%,%{ Array[0] }%, or the.Valueaccess pattern shown in older samples.