From the course: Building and Securing RESTful APIs in ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Returning JSON

Returning JSON - ASP.NET Core Tutorial

From the course: Building and Securing RESTful APIs in ASP.NET Core

Start my 1-month free trial

Returning JSON

- [Instructor] The principles of REST and HATEOAS are format agnostic. In other words, a RESTful API could return XML, HTML, JSON, or something else entirely. JSON has increasingly become a popular response format for APIs on the web. Let's take a closer look at the advantages and disadvantages of JSON and discuss how to properly craft a RESTful JSON API. One of the biggest reasons why JSON has eclipsed XML in popularity is that it's lightweight and easy for humans to read. It's also easy for machines to read because it doesn't require a heavy XML parsing engine. That means it's easy to find support for reading and writing JSON on almost any platform across the web, plus desktop and mobile devices. On the other hand, because JSON doesn't have a built-in way to enforce or even define a document schema, it's much looser than XML. There's no standard way of defining document metadata or guaranteeing clients a particular document structure. To remove this disadvantage, it's a good…

Contents