>>> import simplejson
>>> data={'s': 1, 'd': {'kwds': {u'"ramana"': {u'"ramana"': [(0L, 7L)]}}}}
>>> print simplejson.dumps(data, ensure_ascii=False)
Then I got like this.
{"s": 1, "d": {"kwds": {"\"ramana\"": {"\"ramana\"": [[0, 7]]}}}}
But I want to get like:
{"s": 1, "d": {"kwds": {""ramana"": {""ramana"": [[0, 7]]}}}}
How to do that?
It is just a representation of data. You can ignore it.
Why it is represented like that?
""
means an empty string in Python. So, if you have sentence like thisWhen the computer processes it, it might become
And it will be treated as two different strings (
"Welcome to "
and" Guys"
). Now, What isSO
, here? That's whysimplejson
escapes the"
character with\
. But the data is safe,Check this example
Output
And
simplejson
does that because of JSON's specification