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

Create custom JSON encoder for Nothing values #6082

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Jan 27, 2022

Closes #5415

Creates custom JSON encoder which converts Nothing objects into None. Adds encoder to helpers.dump.

Technical

format.dump appears to only be used in lists.py to return data related to lists.

Testing

This code is on testing now. Compare the following list data in production and testing:

http://openlibrary.org/people/tmanarl/lists/OL197952L/seeds.json?debug=true
http://testing.openlibrary.org/people/tmanarl/lists/OL197952L/seeds.json?debug=true

The production link errors out, while the Nothing values have been replaced with null in the JSON string returned in testing.

Screenshot

Stakeholders

@jimchamp jimchamp added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Jan 27, 2022
@jimchamp jimchamp marked this pull request as ready for review January 27, 2022 22:37
@mekarpeles
Copy link
Member

These changes LGTM, tested on testing

@mekarpeles mekarpeles assigned mekarpeles and unassigned cdrini Feb 7, 2022
@mekarpeles mekarpeles merged commit 782c1c7 into internetarchive:master Feb 7, 2022
@jimchamp jimchamp deleted the 5415/bug/encode-Nothing-values-in-json branch July 15, 2022 23:14
@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
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.

"Nothing type not JSON serializable" errors occurring when fetching list data from /seeds.json
3 participants