Skip to content
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

Update to_plotly_json docstring, and add new to_json_string helper method #4301

Merged
merged 8 commits into from Aug 22, 2023
Merged

Update to_plotly_json docstring, and add new to_json_string helper method #4301

merged 8 commits into from Aug 22, 2023

Conversation

itsluketwist
Copy link
Contributor

@itsluketwist itsluketwist commented Jul 28, 2023

This PR aims to resolve some pain points raised in issue 4281, regarding JSON serialization.

The to_plotly_json method simply returns a dictionary, it is not necessarily JSON compatible (it can have invalid data-types included), plotly does provide an encoder - but this isn't immediately obvious.

I've updated the docstring of to_plotly_json to include a warning about the above, and point at the available encoder, as well as adding a simple utility method that performs the JSON serialization to BasePlotlyType, to keep in line with the BaseFigure interface.

Copy link
Contributor

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 This looks great @itsluketwist - other than my one comment above, just add a changelog entry and we'll be good to merge 🎉

@itsluketwist
Copy link
Contributor Author

@alexcjohnson - all fixed up, should be ready to go! 😄

Issue #4281 can also be closed too.

@alexcjohnson alexcjohnson merged commit b4e307c into plotly:master Aug 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants