Help with parsing HTTP get outcome

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
kratax
Posts: 4
Joined: 07 Apr 2017 23:19

Help with parsing HTTP get outcome

Post by kratax »

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
kratax
Posts: 4
Joined: 07 Apr 2017 23:19

Re: Help with parsing HTTP get outcome

Post by kratax »

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
kratax
Posts: 4
Joined: 07 Apr 2017 23:19

Re: Help with parsing HTTP get outcome

Post by kratax »

I managed to find the right syntax:
results[0].series[0].values[0][1]
included in JSON vDev Creator

ie. solved!
Eckhard
Posts: 32
Joined: 17 Oct 2015 16:18

Re: Help with parsing HTTP get outcome

Post by Eckhard »

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
Post Reply