I have this json value:
["67738","1","67742","1"]
I want to parse the value in C#, for each 2 values, for example, 67738, 1 is one dictionary item of two strings, then 67742 and 1 is another dictionary item with items.
I'm trying something like this:
var dict = new JavaScriptSerializer().Deserialize<Dictionary<object, object>>(modifiers);
Using that command I'm getting this error:
Type 'System.Collections.Generic.Dictionary`2[[System.Object, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],
[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]' is not supported for deserialization of an array.
How can I get that working?
Edit
This is how the JSON is created, maybe I can change something on this side:
var jsonValueObj = [];
$("#modifiersDiv :checkbox:checked").each(function() {
jsonValueObj.push($(this).val(), $(this).attr('data-price'));
});
var jsonValueCol = JSON.stringify(jsonValueObj);