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

fix(object): Object of type WhistleBlowerDict is not JSON serializable #177

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

mgmacias95
Copy link
Member

closes #176

The json.dumps function only accepts native types by default (i.e. list, dict, str, int, etc etc) but it is not prepared to parse user custom types such as UserDict. To parse custom types, it is required to extend the default JsonEncoder class available at the json module. This PR does this, and integrates it into the aiohttp's client session.

This PR also updates the tests to support this use case since the problem was not the dictionary representing the object itself but the context_attributes dictionary inside the object which is an instance of the WhistleBlowerDict class.

@mgmacias95 mgmacias95 merged commit 011039a into master Jan 30, 2024
7 checks passed
@mgmacias95 mgmacias95 deleted the json_serialize branch January 30, 2024 10:08
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.

Object of type WhistleBlowerDict is not JSON serializable
2 participants