title: Express and ejs <%= to render a JSON
body: <p>In my index.ejs I have this code:</p>
  
  <pre><code>var current_user = &lt;%= user %&gt;
  </code></pre>
  
  <p>In my node I have</p>
  
  <pre><code>app.get("/", function(req, res){
      res.locals.user = req.user
      res.render("index")
  })
  </code></pre>
  
  <p>However, on the page I obtain</p>
  
  <pre><code>var current_user = [object Object]
  </code></pre>
  
  <p>and if I write </p>
  
  <pre><code>var current_user = &lt;%= JSON.stringify(user) %&gt;
  </code></pre>
  
  <p>I obtain:</p>
  
  <pre><code>var current_user = {&amp;quot;__v&amp;quot;:0,&amp;quot;_id&amp;quot;:&amp;quot;50bc01938f164ee80b000001&amp;quot;,&amp;quot;agents&amp;quot;:...
  </code></pre>
  
  <p>Is there a way to pass a JSON that will be <strong>JS readable</strong>?</p>