public string GetMatchedCurrency(string text) { EductionResponse _eductionResponse = EduceFromTextAsync(text); // Line bellow is most likely cause for null exception return(CleanCurrency(_eductionResponse.autnresponse.responsedata.hit[0].matched_text).TrimEnd()); }
public EductionResponse EduceFromTextAsync(string text) { string url = $"http://{_settings.Hostname}:{_settings.Port}/Action=EduceFromText&Text={text}&responseFormat=simplejson"; var response = _httpClient.GetAsync(url).GetAwaiter().GetResult(); response.EnsureSuccessStatusCode(); string jsonString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); EductionResponse retval = JsonSerializer.Deserialize <EductionResponse>(jsonString); return(retval); }