Reputation: 41
Trying to serialize Dictionary<string[],int>
var requestData = new Dictionary<string, object>
{
{ "games" ,new Dictionary<string[],int> { {new string[] { "1000"}, 1 } } }
};
var data = JsonConvert.SerializeObject(requestData);
The output JSON
looks something like
{"games":{"(Array)":1}}
which is not what I want. Info of string[]
is gone
Upvotes: 1
Views: 224
Reputation: 43939
Why don't use this:
var requestData = new Dictionary<string, object>
{
{ "games",new Dictionary<int, string[]>{ { 1, new string[] { "1000", "2000"} } }
}
};
var data = JsonConvert.SerializeObject(requestData);
it results
{"games":{"1":["1000","2000"]}}
Upvotes: 1