Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

upload and read json file javascript

async function fileToJSON(file) {
  return new Promise((resolve, reject) => {
    const fileReader = new FileReader()
    fileReader.onload = event => resolve(JSON.parse(event.target.result))
    fileReader.onerror = error => reject(error)
    fileReader.readAsText(file)
  })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: toggle class javascript stack overflow 
Javascript :: firebase firestore delete field 
Javascript :: disable a button in javascript 
Javascript :: for element in string js 
Javascript :: Remove duplication from array in javascript 
Javascript :: moment check greater than current time 
Javascript :: javascript allow only numeric characters 
Javascript :: javascript getminutes 2 digits 
Javascript :: check if string contains at least one number javascript 
Javascript :: react replace all line breaks with br 
Javascript :: javascript string contains character 
Javascript :: search in string array javascript 
Javascript :: DragDropContext 
Javascript :: word to char array javascript 
Javascript :: javascript rupiah currency format 
Javascript :: prevent default jquery 
Javascript :: autocomplete is not working in jsx file vs code 
Javascript :: how to check if a string contains a certain letter in js 
Javascript :: chartjs line color 
Javascript :: shuffle array javascript 
Javascript :: how to define state in react function 
Javascript :: latin science words 
Javascript :: jquery remove multiple classes 
Javascript :: addeventlistener on select option 
Javascript :: how to load image from dir nodejs 
Javascript :: check if element is visible or hidden in dom 
Javascript :: javascript Using Math.min() on an Array 
Javascript :: loop array reverse 
Javascript :: loop over json javascript 
Javascript :: javascript array reorder elements 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =