Vue.js JSON Stringify

We can use native JavaScript JSON stringify() method to convert json object to json string. Here in this tutorial, we are going to explain how you can use this method to convert an json object to json string in JavaScript in vuejs. You can also use our online editor to edit and run the code online.

Vue.js JSON stringify – JavaScript Example

You can use stringify() method in vuejs simply as below-


<div id="app">
	<button @click="myFunction()">Click Me</button>
 new Vue({
el: '#app',
  data: { 
	  myObj:{"firstName":"John", "lastName":"Doe"},
    myFunction: function () {	
		this.myStr = JSON.stringify(this.myObj);


Try it »

Output of above example-


Add Comment

📖 Read More