#33779 closed New feature (fixed)
Add an encoder parameter to django.utils.html.json_script().
Description ¶
I have a use case where I want to customize the JSON encoding of some values to output to the template layer. It looks like django.utils.html.json_script
is a good utility for that, however the JSON encoder is hardcoded to DjangoJSONEncoder
. I think it would be nice to be able to pass a custom encoder class.
By the way, django.utils.html.json_script
is not documented (only its template filter counterpart is), would it be a good thing to add to the docs?
Change History (8)
comment:1 by , 3 years ago
Summary: | Add an encoder parameter to django.utils.html.json_script → Add an encoder parameter to django.utils.html.json_script(). |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 3 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Sounds good, and yes, we should document
django.utils.html.json_script()
.