Dear all,
I try to parse result of HTTP get from influx database. The outcome looks like:
curl -G 'http://localhost:8086/query?u=xxx&p=xxx' --data-urlencode "db=testd" --data-urlencode "q=SELECT value FROM humidity"
{"results":[{"statement_id":0,"series":[{"name":"humidity","columns":["time","value"],"values":[["2017-04-07T18:40:04.707425777Z",0.8]]}]}]}
I would like to parse 0.8 (i.e. value) as a result to be used in HTTP device module.
Thanks a lot!
Kratax
Help with parsing HTTP get outcome
Re: Help with parsing HTTP get outcome
Hi all,
I have managed to get probably right value using
$..['values']['0']['1']
tested on
https://jsonpath.curiousconcept.com/#
but if I use this in module JSON vDev Creator in field JSON path expression, I receive
00:28 | Can not parse JSON data
any help with this?
Thanks a lot!
Kratax
I have managed to get probably right value using
$..['values']['0']['1']
tested on
https://jsonpath.curiousconcept.com/#
but if I use this in module JSON vDev Creator in field JSON path expression, I receive
00:28 | Can not parse JSON data
any help with this?
Thanks a lot!
Kratax
Re: Help with parsing HTTP get outcome
I managed to find the right syntax:
results[0].series[0].values[0][1]
included in JSON vDev Creator
ie. solved!
results[0].series[0].values[0][1]
included in JSON vDev Creator
ie. solved!
Re: Help with parsing HTTP get outcome
I just trying the JSON vDev Creator. I always get a JSON Parse error. In the log I see the right value (-1445):
[2018-03-20 14:48:15.070] [core] --- Starting module JSON vDev Creator
[2018-03-20 14:48:15.124] [core] Creating device sensorMultilevel JSONDevice_18
[2018-03-20 14:48:15.199] [core] jsonPath: Pwi
[2018-03-20 14:48:15.200] [core] Url: http://192.168.1.6/zaehlerstand.sh
[2018-03-20 14:48:15.202] [core] Float: false
[2018-03-20 14:48:15.204] [core] Numerical: false
[2018-03-20 14:48:15.206] [core] Debug: true
[2018-03-20 14:48:15.267] [core] key: Zeit
[2018-03-20 14:48:15.269] [core] key: Win
[2018-03-20 14:48:15.271] [core] key: Wout
[2018-03-20 14:48:15.273] [I] [core] key: Pwi
[2018-03-20 14:48:15.277] [I] [core] RegExp parser - input: -1445
[2018-03-20 14:48:15.315] [I] [core] Notification: error (module): Can not parse JSON data
[2018-03-20 14:48:15.317] [I] [core] jsonPath: Pwi
What is the meaning of the configuration values of the JSON vDev Creator App?
Thanks, Eckhard
[2018-03-20 14:48:15.070] [core] --- Starting module JSON vDev Creator
[2018-03-20 14:48:15.124] [core] Creating device sensorMultilevel JSONDevice_18
[2018-03-20 14:48:15.199] [core] jsonPath: Pwi
[2018-03-20 14:48:15.200] [core] Url: http://192.168.1.6/zaehlerstand.sh
[2018-03-20 14:48:15.202] [core] Float: false
[2018-03-20 14:48:15.204] [core] Numerical: false
[2018-03-20 14:48:15.206] [core] Debug: true
[2018-03-20 14:48:15.267] [core] key: Zeit
[2018-03-20 14:48:15.269] [core] key: Win
[2018-03-20 14:48:15.271] [core] key: Wout
[2018-03-20 14:48:15.273] [I] [core] key: Pwi
[2018-03-20 14:48:15.277] [I] [core] RegExp parser - input: -1445
[2018-03-20 14:48:15.315] [I] [core] Notification: error (module): Can not parse JSON data
[2018-03-20 14:48:15.317] [I] [core] jsonPath: Pwi
What is the meaning of the configuration values of the JSON vDev Creator App?
Thanks, Eckhard