Closed chunlizh closed 7 years ago
What is the jsonstr
value?
private static void DictListTest()
{
fastJSON.JSON.Parameters.UseExtensions = false;
Dictionary<string, List<AC>> dictList = new Dictionary<string, List<AC>>();
dictList.Add("P", new List<AC>());
dictList["P"].Add(new AC() { });
string jsonstr = fastJSON.JSON.ToJSON(dictList);
Console.WriteLine();
Console.WriteLine(jsonstr);
Dictionary<string, List<AC>> dictList2 = fastJSON.JSON.ToObject<Dictionary<string, List<AC>>>(jsonstr);
foreach (var k in dictList2)
{
Console.Write(k.Key);
foreach (var v in k.Value)
Console.WriteLine(":\tLo:{0}\tRatio:{1}", v.Lo, v.Ratio);
}
}
if set fastJSON.JSON.Parameters.UseExtensions = false,is't work
Fixed, will post soon, thanks!
i having a Class named "AC", then i have define
Dictionary<string, List<AC>> AdjustConfig;
public class AC { public AC() { } public decimal Lo { get; set; } public decimal Ratio { get; set; } }
ToObject<Dictionary<string, List>>(jsonstr) is't work