Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

read json file with fetch

const todoUrl ='https://jsonplaceholder.typicode.com/todos';
  
function getAllTodos(){
        return new Promise((resolve => {
            fetch(new Request(todoUrl)).
            then( res => {
                return res.json();
            })
            .then(data => {resolve(data);
            });
        }))
    }
Source by github.com #
 
PREVIOUS NEXT
Tagged: #read #json #file #fetch
ADD COMMENT
Topic
Name
6+5 =