title: Problem in looping a JSON array in vue.js
body: <p>I want to loop through a JSON Array to search for a keyword. I am refering <a href="https://stackoverflow.com/questions/8517089/js-search-in-object-values">this thread to achieve this.</a> </p>
  
  <p>entries is a JSON array of stucture </p>
  
  <pre><code>[
      {"a": "something", "id": 54785, "b": ["each", "every", "one"]},
      {"a": "something", "id": 54785, "b": ["each", "every", "one"]},
      {"a": "something", "id": 54785, "b": ["each", "every", "one"]},
  ]
  </code></pre>
  
  <p><code>searchItem</code> came from this custom component</p>
  
  <pre><code>&lt;FormInput type="text"
      v-model="searchItem"
      @input="searchObject()"
      placeholder="Search here"&gt;
  &lt;/FormInput&gt; 
  </code></pre>
  
  <p>I placed my function in methods of component like this.</p>
  
  <pre><code>searchObject: function() {
    for (var i=0; i&lt;this.entries.length; i++) {
      for (var key in this.entries[i]) {
        if (this.entries[i].key.indexOf(this.searchItem)!==-1) {
          this.result.push(this.entries[i])
        }
      }
    }
    return this.result
  }
  </code></pre>
  
  <p>I get this error in console </p>
  
  <pre><code>TypeError: Cannot read property 'indexOf' of undefined
  </code></pre>
  
  <p>When I change in computed function and try <code>[key]</code> instead of <code>.key</code></p>
  
  <pre><code>searchObject() {
    for (var i=0; i&lt;this.entries.length; i++) {
      for (var key in this.entries[i]) {
        if (this.entries[i][key].indexOf(this.searchItem)!==-1) {
          this.result.push(this.entries[i])
        }
      }
    }
    return this.result
  }
  </code></pre>
  
  <p>I am not getting anything pushed in result, neither I am getting any error in console. I tried to put console.log() command on my function, but again nothing on console.</p>