Python3:

>>> b'\\u201c'.decode('unicode_escape')
'“'

or

>>> '\\u201c'.encode().decode('unicode_escape')
'“'
Answer from max5555 on Stack Overflow
🌐
py4u
py4u.org › blog › python-regex-to-replace-double-backslash-with-single-backslash
How to Replace Double Backslash with Single Backslash in Python Using Regex: Fixing Common Escape Errors
\U is a Unicode escape (causes error in Python 3) # To avoid errors, you must escape backslashes: path = "C:\\Users\\John" # Now Python stores it as "C:\Users\John" (single backslashes) print(path) # Output: C:\Users\John (appears correct, but let's check the actual string) print(repr(path)) # Output: 'C:\\Users\\John' (Python represents it with double backslashes) When reading strings from files, JSON, or external sources, backslashes are often escaped twice.
Discussions

python - json.dumps() : how to escape double quotes with a single backslash - Stack Overflow
When I use json.dumps(), I get the following output: ... This results in unescaped double quotes. Is there a way to always have one backslash; something like: More on stackoverflow.com
🌐 stackoverflow.com
python replace single backslash with double backslash
• python replace single backslash with double backslash • Escaping backslash in string - javascript • File path issues in R using Windows ("Hex digits in character string" error) • Replace "\\" with "\" in a string in C# • How to remove backslash on json_encode() function? More on syntaxfix.com
🌐 syntaxfix.com
9
54
June 26, 2013
python - Converting backslash single quote \' to backslash double quote \" for JSON - Stack Overflow
I've got a JSON file that was converted to a string in Python. Somehow along the way the double quotes have gotten replaced with single quotes. {\'MyJSON\': {\'Report\': \'1\' .... I need to conver... More on stackoverflow.com
🌐 stackoverflow.com
Manage double backslashes added automatically by JSON in python - Stack Overflow
you need to escape the backslash character in python with a backslash. Thats why there is a quadruple-backslash. But keep in mind that json adds those extra-backslashes for a reason. After replacing them, you will not be able to use json.reads() to get the original password. Json uses the backslash to escape the backslash. So a double-backslash in json stands for a single ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Quora
quora.com › How-do-you-change-a-double-backslash-to-a-single-back-slash-in-Python
How to change a double backslash to a single back slash in Python - Quora
Answer: This is an interesting one. A few important notes before my answer code: * To put a backslash in a string literal, type two backslashes. The first one indicates the start of an escape sequence; the second one indicates you want the escape sequence to produce a backslash. (If you wanted ...
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 54876010 › python-3-when-writing-json-file-double-backslash-problem
Python 3 when writing json file double backslash problem - Stack Overflow
a = re.findall( # "r" prefix to string is unnecessary '<b><a[^>]* href="([^"]*)"', response.decode('UTF-8', 'replace')) sub_req = Request('https://www.manga-tr.com/'+a[3], headers=headers) sub_response = urlopen(sub_req).read() manga = {} manga['manga'] = [] manga_subject = re.findall( # "r" prefix to string is unnecessary '<h3>Tanıtım</h3>([^<]*)', sub_response.decode('UTF-8', 'replace')) manga['manga'].append({'msubject': manga_subject }) # io.open is the same as open with open('allmanga.json', 'w', encoding='utf-8-sig') as fp: # json.dumps is unnecessary json.dump(manga, fp, indent=4) The Requests library is much easier than using urlopen. You will have to install it (with pip, apt, dnf, etc, whatever you use), it does not come with Python.
Top answer
1 of 2
3

You are seeing an escaped forward slash. The JSON standard allows any character to be escaped, and the forward slash can be escaped by preceding it with a backward slash. See the Strings section of RFC 7159.

So \/ is an just an escaped representation for the value /:

>>> import json
>>> print json.loads(r'{"date": "\/Date(1411084800000)\/"}')
{u'date': u'/Date(1411084800000)/'}

Note how the \/ is decoded to / in the output. This escaping is entirely optional.

Your browser does the same thing; when any compliant JSON value which includes strings containing \/ sequences is being parsed, the resulting string values containg just / forward slashes. When the Kendo JSONP response (which does use \/ in strings) is received, the browser produces the exact same result as a JSONP response with the forward slashes left un-escaped.

Just provide the value in Python with the forward slashes. json.dumps() will not escape the forward slash (it doesn't have to escape it), and your browser and any other JSON compliant parser will produce the exact same value:

>>> print json.dumps({'date': '/Date(1411084800000)/'})
{"date": "/Date(1411084800000)/"}
2 of 2
0

While Martijn is absolutely correct, he does include a caveat about the far end being compliant. If it isn't, like JustGiving, then you might find the following a useful starting point:

class DateJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime.date):
            javascript_date = int(o.strftime("%s"))*1000
            return r'\/Date({0}+0000)\/'.format(javascript_date)
        return JSONEncoder.default(self, o)

    def encode(self, o):
        encoded = super(DateJSONEncoder, self).encode(o)
        encoded = encoded.replace(r"\\/", r"\/").replace(r")\\/", r")\/")
        return encoded
🌐
Reddit
reddit.com › r/learnpython › how do i conviniently convert a json string with backslashes into a regular json string.
r/learnpython on Reddit: how do i conviniently convert a JSON string with backslashes into a regular JSON string.
June 20, 2024 -

I'm writing my first python code so i'm not familiar with any libraries etc.

I have this json string

"{\"systemUri\":\"https://myserver:443/bc-testrest/ODataV4\",\"dateTime\":\"06/20/24 11:53 AM\",\"applicationOK\":true,\"databaseOK\":true}"  

and my goal is to convert it to a regular json string like this

{"systemUri":"https://myserver:443/bc-testrest/ODataV4","dateTime":"06/20/24 11:53 AM","applicationOK":true,"databaseOK":true} 

so i can load it into a python dict with json.loads. How can i do that?

🌐
Python
python-list.python.narkive.com › Z4CBbwL7 › how-to-replace-double-backslash-with-one-backslash-in-string
how to replace double backslash with one backslash in string...
You never had a 3 char string: the \ escapes are valid in python code, but not in strings read from the user by any means. Typing \x20 in a Tkinter entry is the same as reading a file containing the characters '\', 'x', '2' and '0': you get exactly these characters, not the character represented by this string if you had put it in your code. Post by Vincent Texier I've tried a re.sub(r'\\', chr(92)) but chr(92) is a double backslash again.
🌐
Fmyly
en.fmyly.com › article › how-to-pass-backslash-in-json
How to Pass Backslash in JSON: A Comprehensive Guide for Seamless Data Handling - Fmyly
May 10, 2026 - For every literal backslash (`\`) that you want to appear in your JSON string, replace it with a double backslash (`\\`). ... When you’re using a programming language (like Python, JavaScript, Java, C#) to generate JSON, the serialization library usually handles this automatically.
🌐
Python Forum
python-forum.io › thread-2466.html
Replace Single Backslash with Double Backslash in python
March 19, 2017 - I have a need to replace single backslashes with double backslashes. I know that the replace method of the string object can be used, however I'm not able to figure out the correct combination given that the backslash serves as an escape character. A...
🌐
GeeksforGeeks
geeksforgeeks.org › python › escape-double-quotes-for-json-in-python
Escape Double Quotes for Json in Python - GeeksforGeeks
July 23, 2025 - In this example, the backslashes before the inner double quotes prevent them from being interpreted as the closing quotes for the string. ... Another approach is to use single quotes (') for the outer string.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-remove-backslash-from-string
Remove Backslashes or Forward slashes from String in Python | bobbyhadz
April 10, 2024 - The slice string[:-1] starts at index 0 and goes up to, but not including the last character of the string. The str.replace() method can also be used to replace double backslash with single backslash.