I'm using the following procedure to grab a json file and break it down into a dictionary file which I can further use. The code I'm using is as follows:
import urllib
import json
pricelist_link="http://foo.com/test.json"
price_instance=urllib.urlopen(pricelist_link)
print type(price_instance)
parsed_price_data = json.loads(price_instance.read())
print type(parsed_price_data)
print parsed_price_data
This appears to be the standard way of doing this (I've seen suggestions of using urllib2 instead, however that did not yield different results for me.
When I view the JSON file in the browser, it appears normal, with double quotes:
{"AK-47 | Aquamarine Revenge (Battle-Scarred)":{"2016-01-26":{"price":821,"count":19},"2016-01-27":{"price":762,"count":24},"2016-01-28":{"price":745,"count":22},"2016-01-29":...
However when I print the "parsed_price_data", it appears with a u
before single quotes.
{u'P250 | Muertos (Battle-Scarred)': {u'2016-03-13': {u'count': 3, u'price': 118}, u'2016-03-17': {u'count': 3, u'price': 129}, u'2016-03-01': {u'count':
I'm not worried about the double quotes going to single quotes, but what is with the u
? Is there an easy way to remedy this without a cumbersome regex?