From 307513353389cde23cc5f0c8194761df75029c3a Mon Sep 17 00:00:00 2001 From: Alexey Skalozub Date: Sat, 11 Aug 2018 01:25:57 +0300 Subject: [PATCH] Specify explicit json serializer settings --- .../Dashboard/JobProgressDispatcher.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Hangfire.Console/Dashboard/JobProgressDispatcher.cs b/src/Hangfire.Console/Dashboard/JobProgressDispatcher.cs index 0113209..aff33f3 100644 --- a/src/Hangfire.Console/Dashboard/JobProgressDispatcher.cs +++ b/src/Hangfire.Console/Dashboard/JobProgressDispatcher.cs @@ -8,6 +8,7 @@ using Hangfire.Dashboard; using Hangfire.States; using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; namespace Hangfire.Console.Dashboard { @@ -16,6 +17,14 @@ namespace Hangfire.Console.Dashboard /// internal class JobProgressDispatcher : IDashboardDispatcher { + private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings() + { + ContractResolver = new CamelCasePropertyNamesContractResolver() + { + NamingStrategy = new CamelCaseNamingStrategy(false, true) + } + }; + // ReSharper disable once NotAccessedField.Local private readonly ConsoleOptions _options; @@ -62,7 +71,7 @@ public async Task Dispatch(DashboardContext context) } } - var serialized = JsonConvert.SerializeObject(result); + var serialized = JsonConvert.SerializeObject(result, JsonSettings); context.Response.ContentType = "application/json"; await context.Response.WriteAsync(serialized);