I'm newbie in javascript and I have a problem to parse Json

I read the similar question but none of them give me a correct answers.

in my code there are below functions that should parse a json file called wifi.txt when page loading.

```
function responsewifi(){
    if(this.readyState==4 && this.status ==200){
        myobj = JSON.parse(this.responseText);

        document.getElementById("SSID").value = myobj.SSID;
        document.getElementById("APKEY").value = myobj.APKEY;
        document.getElementById("ESPAPNAME").value = myobj.ESPAPNAME;
        document.getElementById("ESPAPKEY").value = myobj.ESPAPKEY;
        var wifimodes = myobj.wifimode;
        if(wifimodes=="STAmode"){document.getElementById("STAmode").checked = true;}
        if(wifimodes=="APmode"){document.getElementById("APmode").checked = true;}
        if(wifimodes=="MULTImode"){document.getElementById("MULTImode").checked = true;}
    }
}
function processwificonfig()
{
    regwifi.open("get","wifi.txt",true);
    regwifi.onreadystatechange = responsewifi;
    regwifi.send();
}

processwificonfig();

```

the problem is that when page load the code `myobj = JSON.parse(this.responseText);` doesn't work and its below code doesn't work too.

I try `consol.log` and `alert("test")` in every line of top code but just code before `myobj = JSON.parse(this.responseText);` work correctly

I get the following error

```
Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at XMLHttpRequest.responsewifi

```

myobj is a var

```

I code this for a NODEMCU ESP8266 project.

```