[Vuejs]-How to pass/import server-side JSON to a vue app?

0πŸ‘

βœ…

As an extension of my comment: what you’re looking for is to actually fetch the JSON from your server using an XMLHttpRequest. You can do this in a modern, ES6-manner using the Fetch API:

fetch('/path/to/your/json')
  .then(resp => resp.json())
  .then(data => {
    // Access the parsed JSON as `data`
    console.log(data);
  });

0πŸ‘

If you can try using a .js file that migh work and you can structure the data the same way as in a .json file, afterall a json is just a js object, also i had this problem while doing the same thing.
DISCLAIMER: you might have to restructure your data to be in an exported variable if that is possible, like so:

export const myObj = {your json}

Leave a comment