How to do it...

To see it in action, we can simply display the value of an object in our Vue instance.

  1. Write the following JavaScript:
        new Vue({           el: '#app',           data: {             cat: {               sound: 'meow'             }           }         })

This just creates a cat object in our code with a string inside.

  1. Write the following HTML:
        <p>Cat object: {{ cat }}</p>
  1. Run your app and notice how the cat object is outputted in all it's beauty, just like JSON.stringify.

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.