@comtech wrote:
I am attempting to build some if variables into my dialplan and am having trouble with two statements that I need to add on. I am sure it is escape keys, but I am not sure what exactly is missing. Is anyone able to lend a hand? The script below grabs a JSON result with multiple values, then returns one selected value.
On the Linux command line:
curl -s 'https://some.JSON.output' | python -c "import sys, json; print json.load(sys.stdin)['AUX']"
It works. It returns a value of 10.when I try:
expr curl -s 'https://some.JSON.output' | python -c "import sys, json; print json.load(sys.stdin)['AUX']"or
expr 1 + curl -s 'https://some.JSON.output' | python -c "import sys, json; print json.load(sys.stdin)['AUX']"
I get:
expr: syntax error
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/json/__init__.py", line 267, in load
parse_constant=parse_constant, **kw)
File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return defaultdecoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.6/json/decoder.py", line 338, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decodedAny ideas? Much appreciated!
Posts: 2
Participants: 1