-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Handle serializing dicts with ints and strings #3380
Comments
@jonmmease is this something you could take a look at please? There's going to be some ambiguity if the same dict has |
Admittedly, that's an ambiguity that JSON imposes. |
FWIW, this can be reproduced without plotly.py import json
json.dumps({'a': 0, 1: 0}, sort_keys=True)
The reason that we're hitting this now is that we switched to using As @chriddyp pointed out, there is a 2+ year long discussion in https://bugs.python.org/issue25457 on whether this is actually a bug in the Python 3 json module. Maybe it was a mistake to set I don' t see a way to address this from within our custom
Thoughts @nicolaskruchten ? |
Hmmm yeah, it kinda feels like "Remove sort_keys=True, adjusting tests to accept that the json engines will not produce identical results" is the safer route... basically getting folks to opt-in to |
The current
to_json_plotly
doesn't handle dicts with integers and strings as keys. This used to work before we setsort_keys=True
.This is relatively common in Dash.
Here is a MWE:
Here is the issue in the Python tracker: https://bugs.python.org/issue25457 re
sort_keys=True
Originally reported in https://community.plotly.com/t/dash-2-0-0-migration-error/56478/7
The text was updated successfully, but these errors were encountered: