Could you help me cope with the async request. My task is to organize a function to get a city name by IP and return it. But I stuck with this asynchrony.
My code:
async function get_city(){
    // Get city name by IP. 
    const http = new XMLHttpRequest();
    const url='https://api.sypexgeo.net/json/';
    http.open("GET", url);
    http.send();
    var response_json = await JSON.parse(http.responseText);
        return response_json["city"]["name_ru"];    
}
I get this error:
Promise {<rejected>: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at get_city (http://vi…}
?utm_replace=ViarVizualizatorArhiva_TR:645 
?utm_replace=ViarVizualizatorArhiva_TR:591 Uncaught (in promise) SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at get_city (?utm_replace=ViarVizualizatorArhiva_TR:591)
    at replacer (?utm_replace=ViarVizualizatorArhiva_TR:639)
    at ?utm_replace=ViarVizualizatorArhiva_TR:649
How to cope with this error?
 
    