-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
ENH: add option to save json without escaping forward slashes #62830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ENH: add option to save json without escaping forward slashes #62830
Conversation
…e escape_forward_slashes is False
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
…m/zephyrieal/pandas into 61442-json-escape-forward-slashes
|
Hi, the test for Pandas for Pyodide is failing, I'm not sure why because the parts of the repository it relates to I haven't changed. Is this an issue that requires changes in my code to fix? |
| assert result == expected | ||
|
|
||
|
|
||
| def test_to_json_escape_forward_slashes(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a test that also escapes forward slash?
| ) as handles: | ||
| handles.handle.write(s) | ||
| else: | ||
| if not escape_forward_slashes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only apply if you are not writing to a file.
| for letter in s: | ||
| if skip is False: | ||
| if letter + s[i] == pattern: | ||
| new_s = new_s + r"/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this shouldn't be done in python as a post-processing step. Ideally, you should change the behavior on the C implementation.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.Added code in the to_json() function in pandas/io/json/__json.py file.
Will replace escaped forward slashes with forward slashes if escape_forward_slashes parameter is set to False.
Particularly useful for file paths, so the path doesn't get changed.