﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35182	Add support for additional HTML attributes to json_script template tag	LB (Ben Johnston)	nobody	"The `json_script` template filter is useful for bootstrapping server side data into some client-side widgets or JS driven config.

However, in it's current state only a HTML id attribute is supported which means that if you want to leverage low-JS libraries such as Stimulus, HTMX or Alpine.js to 'listen' for the element you have to add an extra layer for finding elements by an id.

Additionally, it makes it difficult to modify other HTML attributes such as `nonce`.

While the type being JSON has an intentionally smaller use case than external scripts it would still be very useful to be able to add other attributes.

Example usage

    {{ value|json_script:""hello-data""@""data-controller='my-controller'"" }}

Would output

    <script id=""hello-data"" type=""application/json"" data-controller='my-controller'>{""hello"": ""world""}</script>

I'm not sure on the best separator for the attributes or if a string or some other value would be better. It would also need to support non-id usage. 

Links
- https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#std-templatefilter-json_script"	New feature	closed	Template system	5.0	Normal	wontfix	json_script	LB (Ben Johnston)	Unreviewed	0	0	0	0	0	0
