:RestSharp ile bir C# Sınıfına dönüşen JSON Nasıl Serileştirilir? Burada bu JSON var
{
"id": "-KDYmr0aI0UmjKRyd465",
"name": "No Name",
"presentation": {
"fields": [
{
"defaultValue": "Erste Node",
"id": "test",
"title": "test",
"type": "text"
},
{
"defaultValue": "Zweite node",
"id": "test2",
"title": "test2",
"type": "text"
}
]
},
"thumbnail": "/images/defaultimage.png",
"updated": "2016-03-23T14:05:32+00:00",
"userData": {
"test": "Erste Node",
"test2": "Zweite node"
}
}
userData kullanıcı bazı veriler eklenirse bağlı değişir.
"userData": {
"test": "Erste Node",
"test2": "Zweite node",
"test3": "More testdata"
}
Ayrıca alanları buna göre güncellenmesi olacaktır ama ben bir C# Class o alanları harita nasıl biliyorum: Yani kullanıcı userdata json şu şekilde görünecektir
{"test3":"More testdata"}
gibi bazı veriler eklendi diyelim. Benim sorum ben bir C# Class olarak bu userData serialize mümkün olacaktır nasıl - ama aynı zamanda buradan RestSharp Client kullanımı ile: hemen hemen benim sınıfları gibi görünecektir nasıl
http://restsharp.org/
. Ama
public class Field
{
public string defaultValue { get; set; }
public string id { get; set; }
public string title { get; set; }
public string type { get; set; }
}
public class Presentation
{
public List<Field> fields { get; set; }
}
public class RootObject
{
public string id { get; set; }
public string name { get; set; }
public Presentation presentation { get; set; }
public string thumbnail { get; set; }
public string updated { get; set; }
public UserData userData { get; set; }
}
için Sözlük kullanabilirsiniz düşünüyorum. Bunlarla yineleyebilir miyim veya bunları benim durumumda nasıl kullanırım? – Kazoooka
Bazı örnek kodla güncellendi. –