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

Using DjangoJSONEncoder in json.dumps #180

Closed
CleitonDeLima opened this issue Jan 7, 2022 · 2 comments · Fixed by #182
Closed

Using DjangoJSONEncoder in json.dumps #180

CleitonDeLima opened this issue Jan 7, 2022 · 2 comments · Fixed by #182

Comments

@CleitonDeLima
Copy link
Contributor

CleitonDeLima commented Jan 7, 2022

Description

Hi,

It might be interesting to use DjangoJSONEncoder when dumping a dict in trigger_client_event.

response[header] = json.dumps(data)

response[header] = json.dumps(data, cls=DjangoJSONEncoder)
@adamchainz
Copy link
Owner

It might be interesting

I guess it would make sense to fit in with Django, but do you have a use case?

Feel free to open a PR. Please do add a test and changelog note.

@CleitonDeLima
Copy link
Contributor Author

I guess it would make sense to fit in with Django, but do you have a use case?

Shen it is necessary to serialize data of type date or decimal, which json.dumps does not support, DjangoJSONEncoder can help in these cases.

I did a PR with a test of this.

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 a pull request may close this issue.

2 participants