简体   繁体   中英

Python: escaping issue with ujson

I am using ujson to convert dictionary to json. when 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM