Skip to main content

Retrieve values from JSON

Retrieve values from a provided JSON. Use JSON path to indicate the text to be retrieved from the JSON. You can extract multiple pieces of information from a JSON by providing a JSON object in the JSON path field where each key represents a field name that must match the Fields to capture names and each value is the corresponding JSON path expression.

You can find more information on how to use JSON path at this link: https://pypi.org/project/jsonpath-ng/

Review JSON Configuration Instructions below

Application

  • Text

Inputs (what you have)

NameDescriptionData TypeRequired?Example
JSON TextText in JSON format that you are looking to retrieve values fromText (Long)Yes{“key”:”value”}
JSON pathThe JSON path to the object or value in the text you would like to retrieve.Text (Long)Yes("Field1":"$.key"}
Fields to capture nameThe name of the field to capture in which to add the JSON valueText (Short)YesField1
Format outputs as an array?Format outputs as an arrayTrue/FalseNoTrue

Note: the value of inputs can either be a set value in the configuration of the Wrk Action within the Wrkflow, or a variable from the Data library section. These variables in the Data library section are the outputs of previous Wrk Actions in the Wrkflow.

Outputs (what you get)

NameDescriptionData TypeRequired?Example
Fields to captureA new field to add the value from the input JSON. This field name must match the value in New field nameText (Long)YesField1

Outcomes

NameDescription
SuccessThis status is selected if details are extracted from the JSON.
No resultThis status is selected in the event of the following scenarios:None of the provided fields to capture found keys in the provided JSON
UnsuccessfulThis status is selected in the event of the following scenarios:The input text is not in JSON formatting and could not be converted.

JSON Path Configuration Instructions

Atomic expressions:

SyntaxMeaning
$The root object
thisThe “current” object.
fooMore generally, this syntax allows “named operators” to extend JSON path in arbitrary ways
fieldSpecified field(s), described below
[ field ]Same as field
[ idx ]Array access, is described below (this is always unambiguous with field access)

Jsonpath operators:

SyntaxMeaning
jsonpath1 . jsonpath2All nodes matched by jsonpath2 starting at any node matching jsonpath1
jsonpath [ fieldname ]Same as jsonpath.fieldname
jsonpath1 .. jsonpath2All nodes matched by jsonpath2 that descend from any node matching jsonpath1
jsonpath1 where jsonpath2Any nodes matching jsonpath1 with a child matching jsonpath2
jsonpath1 | jsonpath2Any nodes matching the union of jsonpath1 and jsonpath2

Field specifiers ( field ):

SyntaxMeaning
fieldnamethe field fieldname (from the “current” object)
"fieldname"same as above, for allowing special characters in the fieldname
'fieldname'ditto
*any field
field , fieldeither of the named fields (you can always build an equivalent JSON path using |)

Array specifiers ( idx ):

SyntaxMeaning
[n]array index (may be comma-separated list)
[start?:end?]array slicing
[*]any array index

Functions

nameExample
len$.objects.len
keys$.objects.keys (will return all keys in the object)
str()$.objects.str() (converts response to string)
subSurround your regex with /regex/$.field.sub(/foo\\+(.*)/, \\1)$.field.sub(/regex/, replacement)
split$.field.split(+, 2, -1)$.field.split(sep, segement, maxsplit)*the spaces after the separating commas are required
sorted$.objects.sorted$.objects[/some_field]$.objects[/some_field,/other_field]*Use / to sort ascending and \ to sort descending
filter$.objects[?(@some_field > 5)]$.objects[?some_field = 'foobar']$.objects[?some_field =~ 'foobar']$.objects[?some_field > 5 & other < 2]Supported operators:Equality: ==, =, !=Comparison: >, >=, <, <=Regex match: =Combine multiple criteria with: &Properties can only be compared to static values.Note: If filtering using = then the entire array being filtered must be objects or strings. You cannot use this feature for integers, boolean, or nulls.
arithmetic (-+*/)$.foo * 12$.objects[].cow + $.objects[].cat
String joins / concatenation$.objects[].first_name + ' ' + $.objects[].last_name

JSON Path Configuration Examples

✅ Example 1: Single Field Extraction

Description: Get a user's name from a basic JSON.

JSON Text: { "name": "Alice", "age": 30 }

JSON Path: $.name

Fields to Capture: UserName

Format as Array?: False

Outputs:

UserName: "Alice"


✅ Example 2: Multiple Fields (Flat Structure)

Description: Extract both the user's name and age.

JSON Text: { "name": "Bob", "age": 45 }

JSON Paths:

{ "UserName": "$.name", "UserAge": "$.age" }

Fields to Capture: UserName, UserAge

Format as Array?: False

Outputs:

UserName: "Bob"

UserAge: 45


✅ Example 3: Multiple Fields from Nested Structure

Description: Extract user details (email and city) from nested JSON.

JSON Text:

{ "user": { "contact": { "email": "charlie@example.com", "location": { "city": "New York" } } } }

JSON Paths:

{ "UserEmail": "$.user.contact.email", "UserCity": "$.user.contact.location.city" }

Fields to Capture: UserEmail, UserCity

Format as Array?: False

Outputs:

UserEmail: "charlie@example.com"

UserCity: "New York"

Version# 1.0