FunctionMonkey
FunctionMonkey copied to clipboard
CamelCaseJsonSerializer does not work for ExpandoObject
Hi, I faced out with a problem returning a JObject as response from HTTP Trigger functions. Json.net ignore any serialization settings when serializing JObject (in my case JObject comes from an abstract "object" type property serialized and then deserialized as "object"). In order to workaround this I decided to deserialize as ExpandoObject but returning it as a response I get again json with PascalCase. The reason is that CamelCaseJsonSerializer constructs CamelCaseNamingStrategy with default parameters but should construct as CamelCasePropertyNamesContractResolver does: new CamelCaseNamingStrategy { ProcessDictionaryKeys = true, OverrideSpecifiedNames = true }
It would be also nice to tweak CamelCaseJsonSerializer and also add a support serialization of JObject e.g. like: var expandoObject = JsonConvert.DeserializeObject<ExpandoObject>(jObject.ToString()); var camelCaseJObject = JObject.FromObject(expandoObject, JsonSerializer);