/* -------------------------------------- Helper Methods -------------------------------------- */ private List <string> getQueryInterpretations(string query) { // Perform a web request to interpret the user's query WebRequest request = WebRequest.Create(interpretUrl + "?query=" + query + "&count=10" + "&complete=1" + "&subscription-key=" + apiData.getMicrosoftKey()); request.Method = "GET"; WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string responseFromServer = reader.ReadToEnd(); reader.Close(); response.Close(); // Deserialize JSON dynamic responseJson = JsonConvert.DeserializeObject(responseFromServer); List <string> interpretations = new List <string>(); // Add the returned interpretations to a list foreach (dynamic interpretation in responseJson.interpretations) { interpretations.Add((string)interpretation.rules[0].output.value); } return(interpretations); }