diff options
author | Larry Ewing <lewing@microsoft.com> | 2020-02-05 20:58:09 +0300 |
---|---|---|
committer | Larry Ewing <lewing@microsoft.com> | 2020-02-06 05:37:46 +0300 |
commit | 4cb6ca559996aa31bfdd8d9a5658761e097df9bd (patch) | |
tree | 21ddbc0d42946aa5da55368bd15d3bf02fc059a6 /sdks | |
parent | 8ce81f51131c1abd554d5268da2421b3bf33656a (diff) |
[wasm][debugger] Use System.Text.Json in the driver
Diffstat (limited to 'sdks')
-rw-r--r-- | sdks/wasm/ProxyDriver/Startup.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sdks/wasm/ProxyDriver/Startup.cs b/sdks/wasm/ProxyDriver/Startup.cs index 61a18b561b3..59898ce444a 100644 --- a/sdks/wasm/ProxyDriver/Startup.cs +++ b/sdks/wasm/ProxyDriver/Startup.cs @@ -9,8 +9,8 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using System.Net.Http; using System.Collections.Generic; -using Newtonsoft.Json; using System.Linq; +using System.Text.Json; namespace WebAssembly.Net.Debugging { internal class Startup { @@ -102,7 +102,7 @@ namespace WebAssembly.Net.Debugging { var version = await ProxyGetJsonAsync<Dictionary<string, string>> (GetEndpoint (context)); context.Response.ContentType = "application/json"; await context.Response.WriteAsync ( - JsonConvert.SerializeObject (mapFunc (version, context, devToolsHost))); + JsonSerializer.Serialize (mapFunc (version, context, devToolsHost))); } async Task RewriteArray (HttpContext context) @@ -110,7 +110,7 @@ namespace WebAssembly.Net.Debugging { var tabs = await ProxyGetJsonAsync<Dictionary<string, string> []> (GetEndpoint (context)); var alteredTabs = tabs.Select (t => mapFunc (t, context, devToolsHost)).ToArray (); context.Response.ContentType = "application/json"; - await context.Response.WriteAsync (JsonConvert.SerializeObject (alteredTabs)); + await context.Response.WriteAsync (JsonSerializer.Serialize (alteredTabs)); } async Task ConnectProxy (HttpContext context) @@ -138,8 +138,7 @@ namespace WebAssembly.Net.Debugging { { using (var httpClient = new HttpClient ()) { var response = await httpClient.GetAsync (url); - var jsonResponse = await response.Content.ReadAsStringAsync (); - return JsonConvert.DeserializeObject<T> (jsonResponse); + return await JsonSerializer.DeserializeAsync<T> (await response.Content.ReadAsStreamAsync ()); } } } |