Using preprocessing, I'm trying to read some JSON data from a service and it is returning me a string instead of a number.
The JSON is similar to this:
I want to extract the load_average for 1m, so I'm using this JSONPath:
With this path I can reach the correct value, but it happens to be a string.
Instead of receiving 2.08 number, I'm getting [2.08] string (with brackets).
Therefore, my item gets unsupported.
Is there a way to convert this string to a number using JSONPath?
The JSON is similar to this:
Code:
{
"nodes": {
"rHhmEKJNSMmpcV9p5my2CQ": {
"timestamp": null,
"name": "",
"transport_address": "",
"host": "",
"ip": "",
"roles": null,
"attributes": {},
"indices": {},
"os": {
"timestamp": 1655814297289,
"cpu": {
"percent": 19,
"load_average": {
"1m": 2.08,
"5m": 2.16,
"15m": 2.14
}
}
}
}
}
}
Code:
$.nodes.*.os.cpu.load_average.1m
Instead of receiving 2.08 number, I'm getting [2.08] string (with brackets).
Therefore, my item gets unsupported.
Is there a way to convert this string to a number using JSONPath?
Comment