2017-03-17 106 views
0

如何将json字符串转换为下面示例的相应类模型。如何为下面的json字符串创建C#类模型?

请告诉如何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

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; } 
} 
相关问题