It does turn it to two lines of code however you can have
{{ value|json_script:"hello-data" }} in your html
then just load a javascript file (below the above line) with the following embedded in it:
const value = JSON.parse(document.getElementById('hello-data').textContent);
in a Django html template file, there is a section of tags?
EDIT - BETTER WORKAROUND TO SEPARATE HTML and JAVASCRIPT I've learned of: https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#json-script which is the new recommended way of passing data to javascript.
It does turn it to two lines of code however you can have
{{ value|json_script:"hello-data" }}
in your htmlthen just load a javascript file (below the above line) with the following embedded in it:
const value = JSON.parse(document.getElementById('hello-data').textContent);