Horje
how to read json file with file input html Code Example
how to read json file with file input html
(function(){
    
    function onChange(event) {
        var reader = new FileReader();
        reader.onload = onReaderLoad;
        reader.readAsText(event.target.files[0]);
    }

    function onReaderLoad(event){
        console.log(event.target.result);
        var obj = JSON.parse(event.target.result);
        alert_data(obj.name, obj.family);
    }
    
    function alert_data(name, family){
        alert('Name : ' + name + ', Family : ' + family);
    }
 
    document.getElementById('file').addEventListener('change', onChange);

}());




Javascript

Related
New JSDOM and querySelector elems textContent Code Example New JSDOM and querySelector elems textContent Code Example
extract data from object when it  match with array of ids js Code Example extract data from object when it match with array of ids js Code Example
how to subtract time in javascript Code Example how to subtract time in javascript Code Example
Fahrenheit to celsius in javascript Code Example Fahrenheit to celsius in javascript Code Example
play notification sound on chat js Code Example play notification sound on chat js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7