json path extractor

JSON Path Extractor

Version: 17.07

Supported Since: 17.01

What is a JSON Path Extractor?

A JSON Path Extractor is a processing element which extracts a given JSON path from a JSON message payload. Extracted content will be assigned to a given scope variable of the message context.

In order to use this processing element, you must first select the JSON Operations dependency from the processors list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the JSON Operations dependency.

json path extractor outports

Out Ports

Next

The message context will be sent to this outport with the extracted JSON path content assigned to the specified scope variable, if the path extraction process is completed successfully

On Exception

The message context will be sent to this outport if any exception occurred while extracting the provided JSON path

Parameters

Variable Name

Name of the scope variable to be assigned with the extracted JSON path content

JSON Path

JSON path to be extracted from the JSON message payload

For additional information please refer to the JSON Path section of JSON Feature documentation

Sample Use Case

In the following use case, the requirement is to receive a message with a JSON payload from an HTTP NIO Ingress Connector, extract a given JSON path from the received message payload and pass it to a custom processing element, perform some custom processing using the extracted JSON path content and finally deliver the message to a backend service via an HTTP NIO Egress Connector.

The challenge is to extract the given JSON path and provide it to the custom processing element.

json path extractor flow
json path extractor config

In this flow a JSON Path Extractor processing elements is configured to extract the sample JSON path: $.mobile-numbers[:1].type from the input JSON payload and assign the extracted value to the scope variable JSON_VALUE and pass the message context to the next processing element for custom processing.

For the following sample input JSON payload, the value mobile will be assigned to the scope variable JSON_PATH

 {
   "first-name": "John",
   "last-name" : "Doe",
   "age"      : 24,
   "address"  : {
     "streetAddress": "1st Cross Street",
     "city"         : "Colombo",
     "postalCode"   : "81000"
   },
   "telephone-numbers": [
     {
       "type"  : "mobile",
       "number": "074-234-567-890"
     },
     {
       "type"  : "land line",
       "number": "011-234-567-890"
     }
   ]
 }
In this topic
In this topic
Contact Us