Answers for "javascript json get"

4

how get a json object from an api in javascript

let url = 'https://example.com';

fetch(url)
.then(res => res.json())
.then((out) => {
  console.log('Checkout this JSON! ', out);
})
.catch(err => { throw err });
Posted by: Guest on March-17-2020
0

how to show json data in javascript

fetch('people.json')
  .then(function (response) {
    return response.json();
  })
  .then(function (data) {
    appendData(data);
  })
  .catch(function (err) {
    console.log(err);
  });
Posted by: Guest on August-19-2021
3

json object

var myObj, x;
myObj = {"name":"John", "age":30, "car":null};
x = myObj.name;
document.getElementById("demo").innerHTML = x;
Posted by: Guest on April-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language