2 changed files with 106 additions and 0 deletions
@ -0,0 +1,53 @@ |
|||||
|
### JSON Path: |
||||
|
|
||||
|
The expression field is used to extract data from the HTTP response message. |
||||
|
|
||||
|
JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: |
||||
|
|
||||
|
- `$`: The root element of the JSON document; |
||||
|
- `.`: Child operator used to select child elements. For example, $.store.book ; |
||||
|
- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; |
||||
|
|
||||
|
### Examples: |
||||
|
|
||||
|
For example, if we want to extract the device name from the following message, we can use the expression below: |
||||
|
|
||||
|
HTTP response message: |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"sensorModelInfo": { |
||||
|
"sensorName": "AM-123", |
||||
|
"sensorType": "myDeviceType" |
||||
|
}, |
||||
|
"data": { |
||||
|
"temp": 12.2, |
||||
|
"hum": 56, |
||||
|
"status": "ok" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
Expression: |
||||
|
|
||||
|
`${sensorModelInfo.sensorName}` |
||||
|
|
||||
|
Converted data: |
||||
|
|
||||
|
`AM-123` |
||||
|
|
||||
|
If we want to extract all data from the message above, we can use the following expression: |
||||
|
|
||||
|
`${data}` |
||||
|
|
||||
|
Converted data: |
||||
|
|
||||
|
`{"temp": 12.2, "hum": 56, "status": "ok"}` |
||||
|
|
||||
|
Or if we want to extract specific data (for example “temperature”), you can use the following expression: |
||||
|
|
||||
|
`${data.temp}` |
||||
|
|
||||
|
And as a converted data we will get: |
||||
|
|
||||
|
`12.2` |
||||
@ -0,0 +1,53 @@ |
|||||
|
## Request URL expression |
||||
|
|
||||
|
JSONPath expression uses for creating url address to send a message. |
||||
|
|
||||
|
JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: |
||||
|
|
||||
|
- `$`: The root element of the JSON document; |
||||
|
- `.`: Child operator used to select child elements. For example, $.store.book ; |
||||
|
- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; |
||||
|
|
||||
|
### Examples: |
||||
|
|
||||
|
For example, if we want to extract the device name from the following message, we can use the expression below: |
||||
|
|
||||
|
HTTP response message: |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"sensorModelInfo": { |
||||
|
"sensorName": "AM-123", |
||||
|
"sensorType": "myDeviceType" |
||||
|
}, |
||||
|
"data": { |
||||
|
"temp": 12.2, |
||||
|
"hum": 56, |
||||
|
"status": "ok" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
Expression: |
||||
|
|
||||
|
`${sensorModelInfo.sensorName}` |
||||
|
|
||||
|
Converted data: |
||||
|
|
||||
|
`AM-123` |
||||
|
|
||||
|
If we want to extract all data from the message above, we can use the following expression: |
||||
|
|
||||
|
`${data}` |
||||
|
|
||||
|
Converted data: |
||||
|
|
||||
|
`{"temp": 12.2, "hum": 56, "status": "ok"}` |
||||
|
|
||||
|
Or if we want to extract specific data (for example “temperature”), you can use the following expression: |
||||
|
|
||||
|
`${data.temp}` |
||||
|
|
||||
|
And as a converted data we will get: |
||||
|
|
||||
|
`12.2` |
||||
Loading…
Reference in new issue