Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

parse local json file

// pure javascript
let object;
let httpRequest = new XMLHttpRequest(); // asynchronous request
httpRequest.open("GET", "local/path/file.json", true);
httpRequest.send();
httpRequest.addEventListener("readystatechange", function() {
    if (this.readyState === this.DONE) {
      	// when the request has completed
        object = JSON.parse(this.response);
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js toggle boolean 
Javascript :: check if array has same values javascript 
Javascript :: js find first line break in string 
Javascript :: generate random color javascript 
Javascript :: js delete all array items 
Javascript :: Mongoose - populate nested array 
Javascript :: transform javascript 
Javascript :: reference error $ is not defined jquery 
Javascript :: react native callback function uses default state value 
Javascript :: query selector element with 2 classes 
Javascript :: NextJS PWA gitignore 
Javascript :: react native check os 
Javascript :: select remove option jquery 
Javascript :: reverse a linked list javascript 
Javascript :: hashmap iteration javascirpt 
Javascript :: javascript change div order 
Javascript :: redirect with react router v6 
Javascript :: react date picker disable past dates 
Javascript :: discord js convert timestamp to date 
Javascript :: get cookie javascript 
Javascript :: iconify/react - npm 
Javascript :: date.tolocaledatestring is not a function 
Javascript :: the update operation document must contain atomic operators mongodb 
Javascript :: how to append rows in table using jquery each function 
Javascript :: console.time in javascript 
Javascript :: javascript remove empty object items 
Javascript :: vscode regex replace only group 
Javascript :: javascript template string examples 
Javascript :: javascript remove duplicate letters in a string 
Javascript :: speedtest-net node.js 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =