【发布时间】:2015-12-19 05:11:47
【问题描述】:
如何使用FastJSON 将 json 转换为字典。 string(key) 是土壤的名称。
非常感谢!
"Soil": [
{
"name": "Pebbiland",
"retentionrate": 1,
"cost": 100
},
{
"name": "Sandiland",
"retentionrate": 4,
"cost": 500
},
{
"name": "Spongiland",
"retentionrate": 8,
"cost": 1000
}
public class SoilStat
{
public int retentionRate;
public int cost;
}
Dictionary<string, SoilStat> _soilList = new Dictionary<string, SoilStat>();
【问题讨论】:
-
抱歉,在显示的 json 中,“name”只是一个成员 od SoilStat,而不是一个键。它可以作为 SoilStat 列表工作(无论如何在 JSON、NET 中)