开发者

Python: escaping issue with ujson

开发者 https://www.devze.com 2023-04-11 06:06 出处:网络
I am using ujson to convert dictionary to json. w开发者_运维百科hen I run the following line: ujson.dumps({\'key\':\'val\\1\'})

I am using ujson to convert dictionary to json. w开发者_运维百科hen I run the following line:

ujson.dumps({'key':'val\1'})

I get the following result:

[{"key": "val\\1"}]

while I expect/want it to be:

[{"key": "val\1"}]

any idea?


There is no problem, that's what repr looks like for this value. It is \1.

0

精彩评论

暂无评论...
验证码 换一张
取 消