I am trying to print data from fetched JSON, however the data has unicode-decoded data. How can I encode (see example) it to display correctly. I am very new to python and was not able to get it working, I am using Windows 7, python 2.7 on a command line terminal. Thanks!
Example: results>>title:
'R\u00f6yksopp - 49 Percent' has to print it as 'Röyksopp - 49 Percent'
"title": "R\u00f6yksopp - 49 Percent",
JSON:
"results": [{
"style": ["House", "Electro", "Synth-pop"],
"thumb": "http://api.discogs.com/image/R-90-530519-1236701656.jpeg",
"format": ["CD", "Maxi-Single"],
"country": "Europe",
"barcode": ["5 028589 023420", "BEL/BIEM", "LC 3098"],
"uri": "/R%C3%B6yksopp-49-Percent/master/30161",
"label": ["Virgin", "Labels", "Wall Of Sound"],
"catno": "0946 3378752 0",
"year": "2005",
"genre": ["Electronic"],
"title": "R\u00f6yksopp - 49 Percent",
"resource_url": "http://api.discogs.com/masters/30161",
"type": "master",
"id": 30161
}
\u00f6isö. Does Command Prompt support those characters?#!/usr/bin/env python # -*- coding: utf-8 -*- import json d = json.loads(u'''{"title": "R\u00f6yksopp - 49 Percent"}''') print d['title'].encode('utf-8')