Example

This example demonstrates how to use the Transformation to extract sensor data from JSON into individual attributes.

Refer to configuration to understand all configuration options of this Agent.

Step 1: Add the Agent

Drag the JSON Deserializer Transformation Agent to the canvas, link the input endpoint to the sensor readings and the output to the printer. Rename the Agent and save the Data Stream.

Step 2: Configure General

Select the Agent and click Configure. In this case, keep the default Collection.

Step 3: Configure Settings

Set the Json Column - in our example use SensorReading.

Fill in the Payload Definition. Click the + button and enter the name, output alias, and type as follows:

  • assetid, Asset, String

  • temperature, Temperature, Double

  • pressure, Pressure, Double

  • flowrate, Flow Rate, Double

Enter any additional columns from the input payload that you want to include in the output. In this case, add Timestamp for both the column name and alias as we want to keep the same name.

Step 4: Results

Apply the changes, save the Data Stream, and Publish it.

Let's look at the Live Data View. Observe that the incoming payload is replaced by the payload attributes extracted from the sensor JSON as well as the timestamp, the column we chose to keep.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Last updated