title: Filtering a JSON response with Vue
body: <p>I'm practicing using <a href="https://v2.vuejs.org/v2/cookbook/using-axios-to-consume-apis.html" rel="nofollow noreferrer">axios with Vue</a>, but I think this may be more of a general JSON question.</p>
  <p>I've successfully used axios to get my local products.json file and I'm then using filter to create a new array that only has products that have a matching department property, and looping those out.</p>
  <p>Is this the correct way of doing this, or can I actually filter the JSON result on the original axios call? I understand I can to pass a parameter which will in turn perform a specific database call, and only provide the required JSON in the first place.</p>
  <pre><code>data(){
      return {
          products: []
      }
  },
  components: {
      Product
  },
  computed: {
      foodProducts(){
          return this.products.filter(x =&gt; x.department == 'Food')
      }
  },
  mounted() {
      axios
      .get('./json/products.json')
      .then(response =&gt; (this.products = response.data.products))
  }
  </code></pre>
  <p>Thanks. Just trying to clarify the theory behind it.</p>