Help: Extract specific value from CURL/JSON command
Hey guys
I am looking for some help according extracting specific values from a CURL/JSON command line output. My device is a physical 8-port multi-outlet power strip which has a web based API and for my home automation system I would like to extract the state of a specific power outlet.
The command to extract the whole information table looks like this:
`curl -X GET 'http://user:[email protected]/statusjsn.js?components=1' | jq`
The output is the following:
`{`
`"outputs": [`
`{`
`"name": "powerStrip02",`
`"state": 1,`
`"ph_state": 1,`
`"twin": 0,`
`"type": 1,`
`"batch": [`
`0,`
`0,`
`0,`
`0,`
`0`
`],`
`"wdog": [`
`0,`
`2,`
`"0.0.0.0"`
`]`
`},`
`{`
`"name": "esxi02",`
`"state": 1,`
`"ph_state": 1,`
`"twin": 0,`
`"type": 1,`
`"batch": [`
`0,`
`0,`
`0,`
`0,`
`0`
`],`
`"wdog": [`
`0,`
`2,`
`"0.0.0.0"`
`]`
`},`
`{`
`"name": "esxi03",`
`"state": 0,`
`"ph_state": 0,`
`"twin": 0,`