Closed drdexter33 closed 10 months ago
Hello there,
first of all: thanks a lot for purchasing my book :)
Regarding your question, the JSON formatting/indentation depends on the browser you use (some apply indentation & pretty print by default, some don't) and/or how you have configured the Json default settings in your Program.cs
file.
For example, this is how you can activate indentation for all JSON outputs:
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.WriteIndented = true;
});
For additional info, check out this page.
Perfect!
thanks!
At the end of Chapter 2 the book is showing the API result from the https://localhost:55221/boardgames endpoint as being formatted:
My results are not formatted in my web browser:
Should they be?
If I run this in Postman and select Pretty Print, it's formatting correctly:
thanks.