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

Serializing an ExpandoObject results in { key: ..., value: ... } not { key: value } in Mono #4

Closed
craigminihan opened this issue May 7, 2014 · 1 comment

Comments

@craigminihan
Copy link

Serializing an ExpandoObject like:

dynamic obj = new ExpandoObject();
obj.hello = "world";

yields: { "key": "hello", "value": "world" } and not { "hello": "world" }

The problem is this test in JsonSerializer.cs in WriteValue():
else if (_params.KVStyleStringDictionary == false && obj is IDictionary &&
obj.GetType().IsGenericType && obj.GetType().GetGenericArguments()[0] == typeof(string))

which fails since even tho ExpandoObject is a Dictionary<string, object> it is not generic (at least in Mono). I've not tried this in .NET.

There is a simple fix for this which I can PR - let me know!

@mgholam
Copy link
Owner

mgholam commented Nov 11, 2014

Hi Craig,

I don't seem to be getting notifications on comments, sorry for the delay in replying.

If you have a fix by all means send it to me :)

@mgholam mgholam closed this as completed Nov 20, 2014
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

2 participants