Search⌘ K
AI Features

Using JSON Helper Methods

Explore how to utilize JSON helper methods in Blazor WebAssembly for reading, adding, and updating data via HTTP requests. Understand how to use HttpClient.DeleteAsync to delete data and streamline API consumption. This lesson helps you efficiently manage data operations when building web apps using ASP.NET 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)” chapter. ...

The GetFromJsonAsync