Answer the question
In order to leave comments, you need to log in
json file inside?
How to decode json file with cyrillic inside using flask/python. Data from file:
{"data": [{"\u041e\u0431\u043b\u0430\u0441\u0442\u044c": "\u0418\u0432\u0430\u043d\u043e- \u0424\u0440\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0430\u044f", "\u0413\u043e\u0440\u043e\u0434": "\u041a\u043e\u043b\u044c\u0441\u043a\u0438\u0439 \u0440- \u043d", "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435": "288.00"},
....]
"structure": ["\u041e\u0431\u043b\u0430\u0441\u0442\u044c", "\u0413\u043e\u0440\u043e\u0434", "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435"]}
import json
list = [...]
data = json.dumps(list)
print 'Json: %s' % data
# Convert json to python object
new_obj = json.loads(data.decode('utf-8'))
print 'Python obj: %s' % new_obj
Answer the question
In order to leave comments, you need to log in
I tried it myself. Python3:
import json
listok = {'привет': 'медвед'}
data = json.dumps(listok)
print('Json: %s' % data)
new_obj = json.loads(data)
print('Python obj: %s' % new_obj)
Json: {"\u043f\u0440\u0438\u0432\u0435\u0442": "\u043c\u0435\u0434\u0432\u0435\u0434"}
Python obj: {'привет': 'медвед'}
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
listok = {'привет': 'медвед'}
data = json.dumps(listok)
print 'Json: %s' % data
new_obj = json.loads(data)
print('Python obj: %s' % new_obj)
for key in new_obj:
print key, new_obj[key]
Json: {"\u043f\u0440\u0438\u0432\u0435\u0442": "\u043c\u0435\u0434\u0432\u0435\u0434"}
Python obj: {u'\u043f\u0440\u0438\u0432\u0435\u0442': u'\u043c\u0435\u0434\u0432\u0435\u0434'}
привет медвед
One of the best tools for JSON is codebeautify.org/jsonviewer JSON formatter, JSON validator, JSON minify, JSON to XML, JSON to CSV
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question