How does ejs output json objects to js calls on pages?

  node.js, question

How does ejs output json objects to js calls on pages?
This is a problem on CNode, and I have encountered it myself. But it did not solve my problem.
Then I tried it out myself and put out the solution first, but I still feel unnatural and wonder if there is a more natural solution.

Server side code

app.get('/test', function (req, res) {
 res.render('test',{"json":['lzy','dophin','ejs']});
 })

Front end code

<script type="text/javascript">
 Var json =' < percentage-JSON.stringify(json) percentage >';
 json = JSON.parse(json);
 console.log(json[0]);
 </script>