You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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(jObject.ToString());
var camelCaseJObject = JObject.FromObject(expandoObject, JsonSerializer);
The text was updated successfully, but these errors were encountered:
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(jObject.ToString());
var camelCaseJObject = JObject.FromObject(expandoObject, JsonSerializer);
The text was updated successfully, but these errors were encountered: