Skip to content
Documentation
Updated 2 minutes to read
Markdown

The jsonPathKey Formula function returns the property names (keys), not the values, of the JSON nodes that match a JSONPath expression.

List the property names of the ship-to address with jsonPathKey instead of jsonPath, animated walkthrough (7.12)
Animated walkthrough: on the JSON Order Received event of order ORD-10005 in the Order-to-Cash demo, jsonPath with $.shipTo.* returns the address values; jsonPathKey with the same expression returns the property names zip, country, city, street, and region.

jsonPathKey('expression', content)
Parameter Required Description
'expression' Yes A JSONPath expression in single quotes that selects the properties whose names you want, such as '$.paths.*' for every property directly under paths.
content Yes The JSON text: body, context, or the result of another function (see Formula language rules).

The name of every property the expression selects, one value each; duplicates are collapsed. When nothing matches, nothing is returned.

To return the values of the same properties, use jsonPath with the same expression.

Example 1: List the API paths in a Swagger document

Section titled “Example 1: List the API paths in a Swagger document”

The message body is the OpenAPI 3.0.4 document that the Nodinite Web API publishes at https://<web api>/swagger/v1/swagger.json (shortened here):

{
"openapi": "3.0.4",
"info": { "title": "Nodinite.WebAPICore", "version": "1.0" },
"paths": {
"/api/ActiveDirectoryGroups": { "get": { "tags": [ "ActiveDirectoryGroups" ] } },
"...": {}
}
}
jsonPathKey('$.paths.*', body)
/api/ActiveDirectoryGroups
/api/ActiveDirectoryGroups/{id}
/api/ActiveDirectoryGroups/GetByFullName
/api/ActiveDirectoryGroups/IsNameAvailable
/api/ActiveDirectoryGroups/{id}/IsNameAvailable
/api/ActiveDirectoryGroups/{id}/Restore
...

Formula jsonPathKey expression returning the API path keys of the Web API OpenAPI document in the Test Expression tab (7.12)
Each key under paths is returned as its own value, in the case the routes are declared; the full 7.12 document gives 735 unique matches.

{ "order": { "id": "PO-1001", "customer": "ACME", "total": 250 } }
jsonPathKey('$.order.*', body)
id
customer
total

Formula jsonPathKey returning the property names id, customer, and total of an order in the Test Expression tab (7.12)
$.order.* selects every property directly under order; jsonPathKey returns their names, where jsonPath would return PO-1001, ACME, and 250.

  • jsonPathKey takes a JSONPath expression, not a regular expression. To filter the returned names by pattern, nest the result in regex, for example regex('^/api/alarms', jsonPathKey('$.paths.*', body)).

...

Version:
Release date: N/A
Loading...

Explore Nodinite for 30 days – completely free

  • Find out why this is the leading O&M software
  • Prove your business case
  • Test the self-service for the business side

Loading...

See how Nodinite resolves your technical issues, in a LIVE Demo!

Once you submit this request:

  • We will give you a short call to understand the issues you want to tackle.
  • Understand solutions you have tried and why were you not happy with them.
  • Book a convenient slot for a LIVE demo!

Loading...