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

values of Dictionary<string, object> serialized incorrectly #26

Closed
kitbellew opened this issue Oct 16, 2014 · 4 comments
Closed

values of Dictionary<string, object> serialized incorrectly #26

kitbellew opened this issue Oct 16, 2014 · 4 comments
Assignees

Comments

@kitbellew
Copy link

var dict = new Dictionary<string, object>();
dict.Add("0", 0);
dict.Add("1", "1");
dict.Add("2", new List<int> { 2 } );
dict.Add("3", new Dictionary<string,object> {{"3", "3"}});
Console.WriteLine(NetJSON.Serialize(dict));

produces {"0":0,"1":"1","2":System.Collections.Generic.List1[System.Int32],"3":System.Collections.Generic.Dictionary2[System.String,System.Object]}

@kitbellew kitbellew changed the title keys of Dictionary<string, object> serialized incorrectly values of Dictionary<string, object> serialized incorrectly Oct 16, 2014
@rpgmaker
Copy link
Owner

Thanks, I will look it
On Oct 16, 2014 8:51 AM, "Albert Meltzer" notifications@github.com wrote:

var dict = new Dictionary<string, object>();
dict.Add("0", 0);
dict.Add("1", "1");
dict.Add("2", new List { 2 } );
dict.Add("3", new Dictionary<string,object> {{"3", "3"}});
Console.WriteLine(NetJSON.Serialize(dict));

produces
{"0":0,"1":"1","2":System.Collections.Generic.List1[System.Int32],"3":System.Collections.Generic.Dictionary2[System.String,System.Object]}


Reply to this email directly or view it on GitHub
#26.

@rpgmaker rpgmaker self-assigned this Oct 17, 2014
@rpgmaker
Copy link
Owner

Please test. This fix only support recursive values in Dictionary[string, object] and List[any primitive type]. You can set values of Dictionary[string, object] to Dictionary[string, object] as much as you want and it should generate a valid json recursively.

@kitbellew
Copy link
Author

Thanks, will try it. To clarify: List will not work, correct?

@rpgmaker
Copy link
Owner

List works too. The Dictionary is the only one that is constrainted to
Dictionary<string, object> when used as a value of another
Dictionary<string, object>

On Tue, Oct 21, 2014 at 1:15 AM, Albert Meltzer notifications@github.com
wrote:

Thanks, will try it. To clarify: List will not work, correct?


Reply to this email directly or view it on GitHub
#26 (comment).

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