如何将json字符串转换为下面示例的各自的类模型。
请告诉我们如何将json的索引转换为类模型"1": {
{
"caller_audio": {
"errors": [],
"lattice": {
"1": {
"links": {
"0": {
"start": 0,
"end": 0.44,
"weight": 0,
"word_confidence": 0.974111,
"best_path": true,
"word": "!ENTER",
"intensity": 0
}
}
}
}
}
}
答案 0 :(得分:0)
将json的索引转换为类模型" 1":{应该使用IList。
public class LatticeModel
{
public IList<LinksModel> Links { get; set; }
}
public class LinksItemModel
{
public string start { get; set; }
public string end { get; set; }
public string weight { get; set; }
public string word_confidence { get; set; }
public string best_path { get; set; }
public string word { get; set; }
public string intensity { get; set; }
}
public class LinksModel
{
public IList<LinksItemModel> links { get; set; }
}