From a7c29be8cb6abb17a2f0108c1620e29ed782c974 Mon Sep 17 00:00:00 2001 From: Brock Allen Date: Tue, 1 Nov 2022 14:48:09 -0400 Subject: [PATCH] format JSON response in sample clients --- .../Controllers/HomeController.cs | 7 +++++-- clients/src/MvcJarJwt/Controllers/HomeController.cs | 4 ++-- clients/src/MvcJarUriJwt/Controllers/HomeController.cs | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/clients/src/MvcAutomaticTokenManagement/Controllers/HomeController.cs b/clients/src/MvcAutomaticTokenManagement/Controllers/HomeController.cs index a2d5d5b52..adb3fae66 100644 --- a/clients/src/MvcAutomaticTokenManagement/Controllers/HomeController.cs +++ b/clients/src/MvcAutomaticTokenManagement/Controllers/HomeController.cs @@ -3,6 +3,7 @@ using System.Text.Json; using System.Net.Http; using System.Threading.Tasks; +using Clients; namespace MvcCode.Controllers { @@ -27,9 +28,11 @@ public async Task CallApi() var client = _httpClientFactory.CreateClient("client"); var response = await client.GetStringAsync("identity"); - ViewBag.Json = JsonDocument.Parse(response).ToString(); - + ViewBag.Json = response.PrettyPrintJson(); + return View(); } + + } } \ No newline at end of file diff --git a/clients/src/MvcJarJwt/Controllers/HomeController.cs b/clients/src/MvcJarJwt/Controllers/HomeController.cs index 1e78a705e..639c742fa 100644 --- a/clients/src/MvcJarJwt/Controllers/HomeController.cs +++ b/clients/src/MvcJarJwt/Controllers/HomeController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System.Text.Json; +using Clients; using System.Net.Http; using System.Threading.Tasks; @@ -27,7 +27,7 @@ public async Task CallApi() var client = _httpClientFactory.CreateClient("client"); var response = await client.GetStringAsync("identity"); - ViewBag.Json = response; + ViewBag.Json = response.PrettyPrintJson(); return View(); } diff --git a/clients/src/MvcJarUriJwt/Controllers/HomeController.cs b/clients/src/MvcJarUriJwt/Controllers/HomeController.cs index 1e78a705e..639c742fa 100644 --- a/clients/src/MvcJarUriJwt/Controllers/HomeController.cs +++ b/clients/src/MvcJarUriJwt/Controllers/HomeController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System.Text.Json; +using Clients; using System.Net.Http; using System.Threading.Tasks; @@ -27,7 +27,7 @@ public async Task CallApi() var client = _httpClientFactory.CreateClient("client"); var response = await client.GetStringAsync("identity"); - ViewBag.Json = response; + ViewBag.Json = response.PrettyPrintJson(); return View(); }