我正试图将具有以下语法的JSON字符串反序列化为C#类,但我对如何处理"父"对象的动态特性有点困惑:
{"1":[{"id":"12139811","num":"37805729","date":"2012-01-30"},{"id":"12139812","num":"36911026","date":"2012-01-30"}],"2":[{"id":"12158366","num":"17582898","date":"2012-01-30"},{"id":"12207165","num":"38493538","date":"2012-01-30"}]}
任何关于课程外观的帮助都将不胜感激。
(反序列化的语法最好类似
var objects = JsonConvert.DeserializeObject<List<MyObject>>(jsonString);
我认为这是因为你的Json星带有标识符"1"而不是数组。。。所以你可以试试这个
var objects = JsonConvert.DeserializeObject<Dictionay<Object,List<MyObject>>>(jsonString);