Using JSON Helper Methods

Learn the JSON helper method and use it to send requests to a Web API.

There are three JSON helper methods. There is one for reading data, one for adding data, and one for updating data. Since there is not one for deleting data, we will use the HttpClient.DeleteAsync method to delete data.

Relationship between the HTTP Methods and the JSON Helper Methods

JSON Helper Method

HTTP Method

Action

GetFromJsonAsync

GET

Read

PostAsJsonAsync

Post

Create

PutAsJsonAsync

Put

Update

HttpClient.DeleteAsync

Delete

Delete

The preceding table indicates the relationship between the JSON helper methods and the HTTP methods.

Tip: We can also use the HttpClient service and JSON helper methods to call external web API endpoints. By way of an example, see the “Building a Weather App as a Progressive Web App (PWA)” ...