Skip to main content

JsonParseTask

The adapter walks the path specified and returns the value found at that result. If returning JSON data from the HttpGet or HttpPost adapters, you must use this adapter to parse the response.

Input: String representation of a JSON object.

Returns: A numerical result.

Example: Parses the price field from a JSON object

{
"jsonParse": {
"path": "$.price"
}
}

See the JsonParseTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 path

string

JSONPath formatted path to the element. https://t.ly/uLtw / https://www.npmjs.com/package/jsonpath-plus

 aggregationMethod

The technique that will be used to aggregate the results if walking the specified path returns multiple numerical results.

Enums

 AggregationMethod

The methods of combining a list of numerical results.

ValueNameDescription
 0NONE
 1MIN

Grab the minimum value of the results.

 2MAX

Grab the maximum value of the results.

 3SUM

Sum up all of the results.

 4MEAN

Average all of the results.

 5MEDIAN

Grab the median of the results.