Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CamelCaseJsonSerializer does not work for ExpandoObject #150

Open
alexeymarkov opened this issue Apr 15, 2020 · 0 comments
Open

CamelCaseJsonSerializer does not work for ExpandoObject #150

alexeymarkov opened this issue Apr 15, 2020 · 0 comments

Comments

@alexeymarkov
Copy link
Contributor

alexeymarkov commented Apr 15, 2020

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant