26 Kasım 2016 Cumartesi

NewTonsoft JObject Sınıfı

Giriş
Bu sınıf json ve Linq'i beraber kullanabilmemizi sağlar.

Parse metodu
Şöyle yaparız.
//converts the JSON from the API to a usable form
JObject usableJson = JObject.Parse(json); 
operator [] metodu
Elimizde şöyle bir json olsun.
{
  "summonerId": 32033681,
  "modifyDate": 1403658807000,
  "champions": [{
                 ...               },
               {
                 ...
               }
    }]
}
JToken döner. Şöyle yaparız.
// retrieve champion objects
JToken champions = usableJson["champions"];

Hiç yorum yok:

Yorum Gönder