How to pass array of objects to jade display in view?
<p>I am using a twitter node module to retrieve searches using the api and putting them into an array of objects stored in a variable called "tweets" that looks like this:</p>

<pre><code>[ { created_at: 'Sun Jul 24 20:32:34 +0000 2016',
   text: '2 Timothy 1:7 #nofear #power #love #sound-mind',
   user: 
     { id: 90281227, 
       name: 'Anavella', 
       screen_name: 'anavellar' } }, 
 { created_at: 'Sun Jul 24 20:32:34 +0000 2016', 
   text: 'Look, then, that the light in you is not darkness.Lucas 11:35 #Love,
   user: 
     { id: 197893427,
       name: 'Sandra Melanny Rojas',
       screen_name: 'MelannySan' } } ]
</code></pre>

<p>when I print it out on the console. I am rendering the view using the following line of code:</p>

<pre><code>res.render('index', { title: 'Express', data: JSON.stringify(tweets) });
</code></pre>

<p>On the jade template I have something like this:</p>

<pre><code>block content
  h1= title
  p Welcome to #{title}
  -var jsonObj = !{JSON.parse(data)}
  if jsonObj
    ul
      each tweet, i in jsonObj
        li= tweet
</code></pre>

<p>but I get a unexpected token error. </p>

<p>Essentially, what I am trying to do is pass the array of objects that I created in index.js to the index.jade view and be able to iterate through the array of objects so that I can display the result in the view. </p>

<p><strong>UPDATE</strong></p>

<p>I removed the !{} from JSON.parse(data) making it </p>

<pre><code>-var jsonObj = JSON.parse(data)
</code></pre>

<p>which ended up eliminating the unexpected token error. In this case, I still get an error that says "Unexpected end of JSON input" referring to the line I just edited. </p>