decode encoded JSON result in python -


i have json result

{"surlredirect":"http://dez.loc/registration","smsgtitle":null,"smsg":"\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e","bstateerror":false}

how can decode in python. results must such

{"surlredirect":"http://dez.loc/registration","smsgtitle":null,"smsg":"Поздравляем! Регистрация прошла успешно","bstateerror":false}

thanks...

upd

can without using json module?

just use inbuilt python json module load json python object, see unicode strings represented '\u041f' , when use them in application, should appear fine russian text.

>>> json_str= '{"surlredirect":"http://dez.loc/registration","smsgtitle":null,"smsg":"\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e","bstateerror":false}' >>> import json >>> the_dict = json.loads(json_str) >>> the_dict {u'smsgtitle': none, u'bstateerror': false, u'smsg': u'\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e', u'surlredirect': u'http://dez.loc/registration'}  >>> print the_dict['smsg'] Поздравляем! Регистрация прошла успешно 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -