Home > other >  How to remove slashes from couchdb value of a document
How to remove slashes from couchdb value of a document

Time:10-06

I am trying to send data to couchdb database but I saw that it shows it the couchdb document of the database as this but I sended that data : enter image description here like this, res = requests.post('http://admin:pass@localhost:5984/captcha_test', json=json.dumps("jL5ZwzE")) But when I want to see the document where the data is stored, It shows it as :"\"jL5ZwzE\"", I want to remove the slashes. I think it's because I created a view but I don't know. If someone knows, tell me ! Thanks !

CodePudding user response:

json.dumps puts quotation marks around your string, which are than escaped using backslashes. This removes the redundant quotation marks and slashes:

json.dumps("jL5ZwzE")[1:-1]

You could probably skip json.dumps entirely and just pass "jL5ZwzE" instead.

  • Related