- 3 minutes to read

Formula - JsonPathKey

Easily extract keys or paths from JSON messages using the Nodinite JsonPathKey Formula plugin. This page shows you how to use regular expressions and JSONPath to retrieve matching keys or paths from message content, context values, or results from other formulas for your integrations.

✅ Extract keys or paths from any JSON structure with a single formula
✅ Use flexible regular expressions and JSONPath for precise selection
✅ See clear, real-world examples with input, formula, and result


What does the JsonPathKey Formula do?

The JsonPathKey('Expression', Content) Formula function extracts all keys or paths from a JSON structure that match a given regular expression or JSONPath. You can use this function on message bodies, context values, or results from other formulas.


Example 1: Extracting Paths from JSON Body

Input from Body

{"swagger":"2.0","info":{"version":"V1","title":"Nodinite WebAPI","x-swagger-net-version":"8.3.38.001"},"host":"localhost","basePath":"/Nodinite/Dev/WebAPI","schemes":["http"],"paths":{"/api/activedirectorygroups":{"get":{"tags":["ActiveDirectoryGroups"],"summary":"Get a list of Active Directory Groups, limited by specified input","operationId":"ActiveDirectoryGroups_List","consumes":[],"produces":["application/json","text/json"],"parameters":...}}

Formula Expression

JsonPathKey('$.paths.*', body)

Result

/api/activedirectorygroups
/api/activedirectorygroups/{id}
/api/activedirectorygroups/{id}/isnameavailable
...

Extract matches from Json content
Example: Extracting matching paths from JSON body using JsonPathKey


Features

  • Extract keys or paths using a regular expression or JSONPath from JSON content
  • Works with message body, Context, or results from other Formula functions
  • Ensures data integrity across integrated systems

Important

The JsonPathKey plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.


How to use the JsonPathKey Formula

  1. Select Formula as the expression type plugin.
  2. Enter your JsonPathKey expression in the 'Expression' text area.
  3. Provide a JSON string as the Content parameter (e.g., message body, context value, or another formula result).

Syntax

  • Extract from message body:
    JsonPathKey('Expression', body)
  • Extract from message context:
    JsonPathKey('Expression', context('MessageContextKey'))
  • Extract from another formula:
    JsonPathKey('Expression', SomeOtherNestedFormulaFunction(Content))

Next Step