I am attempting to parse data in JSON format from YQL, but it won't work. Specifically, I am getting the following output:
File "C:\Python34\lib\json\__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "C:\Python34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s,0).end())
File "C:\Python34\lib\json\decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting Value: line 1 column 1 (char 0)
This is my first attempt at doing anything with Python. I work primarily in C++ and VBA, but this is for research that I'm doing at school. I've also looked at other questions that are similar on SO, but those were parsing from .txt files, not straight from the internet. Any insight anyone could give would be greatly appreciated--thanks!
Here is my code:
import json
result = json.loads('http://query.yahooapis.com/v1/public/yql?q=select%20Ask%20from%20yahoo.finance.quotes%20where%20symbol%20IN%20(%22CL=F%22)&format=json&env=http://datatables.org/alltables.env') # result is now a dict
print (result['Ask'])