# How to "hard code" the JSON variables into a script tag when I need them in the JavaScript of a page

Following up on this question I would like to find out more in detail how to "hard code the JSON variables into a script tag" when I need to work with them in JavaScript.

For example the tags variable in the page's JSON structure, how can I access this in JavaScript? Do I read it out of the DOM , say, in the load event? Sorry, but I am a bit confused here.

2 replies

Something like this:

{{#entry}}
...
<script>
</script>
...
{{/entry}}

Does that make sense? You can even iterate over lists to generate arrays:

<script>
var tags = [ {{#tags}} { tag: "{{tag}}" }, {{/tags}} ];
</script>