[Vuejs]-Vue problem with display of json response from rest api

0👍

This is a snippet to show the difference between a string and an array:

(async function() {
  const todo = await fetch('https://jsonplaceholder.typicode.com/todos/1')
    .then(response => response.json())
    .then(json => {
      return json
    })

  const stringified = JSON.stringify(todo)

  console.log('JSON object:')
  console.log(todo)
  console.log('Stringified JSON:')
  console.log(stringified)
})();

In the snippet above we receive a todo JSON object, and then console.log() the object itself and a stringified version.

Leave a comment