2017-03-17 59 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; } 
} 
相關問題