var inputElement = document.getElementById('jsonfile'); inputElement.addEventListener('change',handleFiles,false); function handleFiles(){ let selectedFile = document.getElementById('jsonfile'); let reader = new FileReader(); reader.readAsText(selectedFile); reader.onload = function(){ let json = JSON.parse(this.result); console.log(json.name); console.log(json.age); } }