- 3 minutes to read

JSON Path search field expression type plugin

Use this plugin to extract values from JSON messages

The Nodinite JSON Path Search Field Expression Type plugin can be used to find one or more unique values from elements and attributes in your logged JSON documents.

A Logged message comes from a Log Event that is part of the Logging feature of Nodinite and the Search Fields are further used within self-service enabled Log Views for your business.

Quick example

Let's get you started with the following simple demonstration example valid for this search field plugin. For other and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result
{
  "Orders": [
    { "Id": 101 },
	{ "Id": 102 }]
}
$..Id
101
102
JSON Data JSON Path expression Unique values

Features

  • Extract single or multiple unique values from JSON messages (payload)
  • Uses many regular JSON Path expression, read more on Wikipedia

This plugin loads the entire message into RAM, so make sure to apply this extraction method on smaller messages only


How to use

To extract values from JSON messages you must first configure the Search Field, in this example case; The Order Id:

Once a Search Field is configured, values are extracted either during normal processing or from user initiated re-index operations. Extracted values are persisted and stored for as long as the days to keep events property on the Message Type is configured.

Test Expression

You can test an expression when configuring a Search Field in the 'Test Expression' tab

  1. Enter an appropriate payload in the 'Message Body' tab
  2. Select the 'JSON Path' expression type plugin
    SelectJSON PathPlugin
  3. Enter valid JSON Path expression (You can also click on elements/attributes to get a suggestion)
  4. Review result/output, rewrite the code in step 3 until you get the data you seek

The actual result (values) are extracted by the Logging Service and then presented together with the evaluated processing state and the number of unique matches.

Test Expression Valid expression with state output, unique values and total count

If the expression is either invalid or does not match any data, then the following output is presented:
NoResult
Invalid expression yields no result

Examples

graph LR subgraph "Search Fields" sf(fal:fa-search-plus Order Number) end subgraph "Search Field Expressions" sfe(fal:fa-flask JSON Path plugin) end subgraph "MessageTypes" mt1(fal:fa-file Orders) end sf --- sfe sfe ---|Expression| mt1

Basic example

To extract order id(s) for the JSON structure you can use the following valid JSON PAth expression '$..Id'. This expression yields the unique values 101 and 102

Message Body

{
  "Orders": [
    { "Id": 101 },
	{ "Id": 102 }]
}

Expression

$..Id

Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?