Python's JSON library decoder -
i have 2 machines - 1 having windows os , other 1 has linux. have installed python on both of them. in file /lib/json/__init__.py
there loads
method has code
_default_decoder = jsondecoder(encoding=none, object_hook=none, object_pairs_hook=none) return _default_decoder.decode(s)
where s str
or unicode
instance containing json document.
on windows machine, output texts unicode
objects on linux machine rather str
objects. dont know why happening. want them unicode
objects on both machines. please help.
i have written following code on python shells of both machine:
>>> import json >>> json import * >>> default_decoder = jsondecoder(encoding=none, object_hook=none,object_pairs_hook=none) >>> default_decoder.decode(json.dumps({'aaa':'bbb'}))
on windows machine get:
{u'aaa': u'bbb'}
whereas on linux is:
{'aaa': 'bbb'}
Comments
Post a Comment