Vue.JS get Data From JSON

Vue.Js get Data From JSON As We know most of single page apps works with apis and we deal with json data so here in this article we are going to explain how you can get data from JSON file.

Vue.JS get Data From JSON File | Get Data From URL Example

Here we are going to create a simple example which will read data from JSON file using vue.js-


Here is simple json file which contains the following data –

Vue.JS get Data From JSON Example:


Read Data From JSON file in Vue.js

Now let us understand how to read this json object file which contains list of users data.

Read Data List From JSON Url Example:

<script src=""></script>
<script src=""></script>
<div id="app">
<div v-for="udata in userData">
Id : {{ }} Name: {{ }}
var dataURL = '';
var App = new Vue({
  el: '#app',
  data: {
    userData: [] // initialize empty array
  mounted() { // when the Vue app is booted up, this is run automatically.
    var self = this // create a closure to access component in the callback below
    $.getJSON(dataURL, function(data) {
      self.userData = data.users;

Try it »

If You run the above demo it will produce output something like this-

Vue.JS get Data From JSON Example & Demo


Add Comment

📖 Read More