2016-02-09 74 views
-1

我想從我的C#控制器中的Json數組中檢索值。這是我的json數組:C#從Json數組中檢索值

{ 
    name : "Name 1", 
    description : "Description 1", 
    count : 6 
    } 

我如何檢索我的c#控制器中的每個屬性?我知道如何處理對象,但是這個json不是來自對象。

public IList[] getList(IList[] myList) 
     { 
    // How to get the value of the name and the description here ? 

} 
+0

要多少代碼做一個簡單的任務!我將最終創建一個具有所有我需要的屬性的類,然後以這種方式檢索它們:myList.name,myList.description等 – user708683

回答

1

我將最終創建一個我需要的所有屬性的一類,然後檢索他們以同樣的方式我做一個對象:

CustomClass myClass ; 

string name = myClass.name 
string description = myClass.description; 
int count= myClass.count 
...