/// <summary> /// Use text analytics services and detect whether a review is positive or not positive and print out the result to the console /// </summary> static async Task Task1() { var requestBody = new JsonData(); var documents = requestBody.SetEmptyArray("documents"); int i = 0; foreach (string review in ReadReviewsFromJson().Take(10)) { var document = documents.AddEmptyObject(); document["id"] = (++i).ToString(); document["text"] = review; } Response response = await client.GetSentimentAsync(RequestContent.Create(requestBody)); var responseBody = JsonData.FromBytes(response.Content.ToMemory()); if (response.Status == 200) { foreach (var document in responseBody["documents"].Items) { Console.WriteLine($"{document["id"]} is {document["sentiment"]}"); } } else { Console.Error.WriteLine(responseBody["error"]); } }