I have a problem deserializing JSON responses from the RIOT API in C#. I want to get a list of LeagueEntryDTO.
The API return a stream looks like this :
[
{
"leagueId": "c83a16ca-b80e-4456-9f57-bc0f2a6020ae",
"queueType": "RANKED_SOLO_5x5",
"tier": "DIAMOND",
"rank": "II",
"summonerId": "XrhB60yIVT_t6Uwp0XuWRpFYD49_Ypk9ycybSdt6LS9Lv5E",
"summonerName": "MasterPrzecin",
"leaguePoints": 7,
"wins": 68,
"losses": 62,
"veteran": false,
"inactive": false,
"freshBlood": false,
"hotStreak": false},
{
"leagueId": "6b3e4e2e-cc90-4e06-afb2-7c2f4b0be9ab",
"queueType": "RANKED_FLEX_SR",
"tier": "PLATINUM",
"rank": "III",
"summonerId": "XrhB60yIVT_t6Uwp0XuWRpFYD49_Ypk9ycybSdt6LS9Lv5E",
"summonerName": "MasterPrzecin",
"leaguePoints": 58,
"wins": 7,
"losses": 7,
"veteran": false,
"inactive": false,
"freshBlood": false,
"hotStreak": false
}
]
This is my current code to transform the data which is failing:
public class LeagueEntryDTOService : ILeagueEntryDTOService
{
RestClient client = new RestClient("https://eun1.api.riotgames.com/lol/league/v4/entries/");
public LeagueEntryDTOResponse GetLeagueEntryDTO()
{
var request = new RestRequest("by-summoner/{encryptedSummonerId}")
.AddParameter("encryptedSummonerId", "XrhB60yIVT_t6Uwp0XuWRpFYD49_Ypk9ycybSdt6LS9Lv5E", ParameterType.UrlSegment)
.AddParameter("api_key", "key");
var response = client.Execute<LeagueEntryDTOResponse>(request);
if (!response.IsSuccessful)
{
return null;
}
return response.Data;
}
public class LeagueEntryDTOResponse
{
public ICollection<AllRanks> Ranks { get; set; }
}
public class AllRanks
{
public string Tier { get; set; }
public string Rank { get; set; }
public int LeaguePoints { get; set; }
public int Wins { get; set; }
public int Losses { get; set; }
}
}
}
What is a good way to deserialize this data?
You have a list of AllRanks instead of an object that contains a list of AllRanks. If there was a property name before the list array, then you would go about deserializing the json off of LeagueEntryDTOResponse but in this case, List<AllRanks> will do
Try this,
client.Execute<List<AllRanks>>(request)
Also, your class attributes must match the case of the json properties. You can either match the case when declaring the variables or you can add [JsonProperty()] to define the exact match. Since convention is to use first letter as UpperCase, its best to define the JsonProperties like below.
public class AllRanks
{
[JsonProperty("tier")]
public string Tier { get; set; }
[JsonProperty("rank")]
public string Rank { get; set; }
[JsonProperty("leaguePoints")]
public int LeaguePoints { get; set; }
[JsonProperty("wins")]
public int Wins { get; set; }
[JsonProperty("losses")]
public int Losses { get; set; }
}
Since you are returning List<AllRanks>, you will need to change the return type of the method as well,
public List<AllRanks> GetLeagueEntryDTO()
Related
I receive a bill of materials in JSON format via a WebApi, which has a corresponding hierarchy.
The hierarchy or the nesting can be any depth.
An example bill of materials is shown below:
{
"Quantity":0,
"QuantityUnit":"pcs",
"PartNumber":"12345",
"Parent":"",
"Children":[
{
"Quantity":1,
"QuantityUnit":"pcs",
"PartNumber":"88774",
"Parent":"12345",
"Children":[
{
"Quantity":1,
"QuantityUnit":"pcs",
"PartNumber":"42447",
"Parent":"88774"
},
{
"Quantity":0.420,
"QuantityUnit":"kg",
"PartNumber":"12387",
"Parent":"88774"
}
]
}
]
}
How can I resolve this nested structure into a simple structure using JSON.NET in C#?
I want to transform it to:
[
{
"Quantity":0,
"QuantityUnit":"pcs",
"PartNumber":"12345",
"Parent":""
},
{
"Quantity":1,
"QuantityUnit":"pcs",
"PartNumber":"88774",
"Parent":"12345"
},
{
"Quantity":1,
"QuantityUnit":"pcs",
"PartNumber":"42447",
"Parent":"88774"
},
{
"Quantity":0.420,
"QuantityUnit":"kg",
"PartNumber":"12387",
"Parent":"88774"
}
]
For the deserialization I use the following class:
public class Bom
{
public class TopLevel
{
public double Quantity { get; set; }
public string QuantityUnit { get; set; }
public string PartNumber { get; set; }
public string Parent { get; set; }
public List<Item> Children { get; set; }
}
public class Item
{
public double Quantity { get; set; }
public string QuantityUnit { get; set; }
public string PartNumber { get; set; }
public string Parent { get; set; }
}
public double Quantity { get; set; }
public string QuantityUnit { get; set; }
public string PartNumber { get; set; }
public string Parent { get; set; }
public IList<TopLevel> Children { get; set; }
}
Furthermore, I use this code to deserialize the JSON to an object:
Bom bom = JsonConvert.DeserializeObject<Bom>(File.ReadAllText(jsonPath));
First let's define a mapper
JObject Map(JObject source)
{
var result = (JObject)source.DeepClone();
result.Remove("Children");
return result;
}
It simply clones the object and removes the Children property
Next let's define a recursive function to accumulate the JObjects
void Flatten(JArray children, JArray accumulator)
{
if (children == null) return;
foreach (JObject child in children)
{
accumulator.Add(Map(child));
Flatten((JArray)child["Children"], accumulator);
}
}
And finally let's make use of them
var semiParsed = JObject.Parse(json);
var accumulator = new JArray();
accumulator.Add(Map(semiParsed));
Flatten((JArray)semiParsed["Children"], accumulator);
The ToString call on the accumulator will return this
[
{
"Quantity": 0,
"QuantityUnit": "pcs",
"PartNumber": "12345",
"Parent": ""
},
{
"Quantity": 1,
"QuantityUnit": "pcs",
"PartNumber": "88774",
"Parent": "12345"
},
{
"Quantity": 1,
"QuantityUnit": "pcs",
"PartNumber": "42447",
"Parent": "88774"
},
{
"Quantity": 0.42,
"QuantityUnit": "kg",
"PartNumber": "12387",
"Parent": "88774"
}
]
UPDATE #1
If your source json contains a deep hierarchy (lets say more than 5 levels) then the DeepClone is not really efficient, since you are copying the whole subtree.
To fix this problem you just need to rewrite the Map function
JObject Map(JObject source)
=> JObject.FromObject(new
{
Quantity = (double)source["Quantity"],
QuantityUnit = (string)source["QuantityUnit"],
PartNumber = (string)source["PartNumber"],
Parent = (string)source["Parent"]
});
Deserialize the original list, flatten it with Enumerable.SelectMany, and serialize the resulting sequence.
I am attempting to deserialize a JSON array via an SSIS source script component in C# using Newtonsoft JSON.net, but I'm running into the following error when I try to build the SSIS project:
CS0029: Cannot implicitly convert type 'System.Collections.Generic.List<ScriptMain.Order> to <ScriptMain.Order'
I suspect it's something to do with the Order class not being defined as a list, but I'm fairly new to C# and I really don't know, so would really appreciate any advice.
This was working correctly for a JSON string before I attempted to change the code to handle an array - i.e. in the code I changed
Order order = JsonConvert.DeserializeObject<Order>(record);
to
Order order = JsonConvert.DeserializeObject<List<Order>>(record);
Here is the JSON array - it's just a typical order / orderline scenario where one order can have multiple order lines.
[
{
"OrderID": 291,
"CustomerID": 1135,
"OrderDate": "2020-07-21",
"OrderLine": [
{
"OrderLineID": 1,
"ProductID": 2,
"Units": 1,
"ClientID": 2
},
{
"OrderLineID": 2,
"ProductID": 8,
"Units": 2,
"ClientID": 1
}
]
},
{
"OrderID": 292,
"CustomerID": 59,
"OrderDate": "2020-07-21",
"OrderLine": [
{
"OrderLineID": 1,
"ProductID": 5,
"Units": 1,
"ClientID": 1
},
{
"OrderLineID": 2,
"ProductID": 7,
"Units": 2,
"ClientID": 2
},
{
"OrderLineID": 3,
"ProductID": 9,
"Units": 1,
"ClientID": 3
}
]
}
]
and here is the C# from the script component in SSIS:
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
string filePath = Connections.OrdersFile20200720.AcquireConnection(null).ToString();
using (StreamReader fileContents = new StreamReader(filePath))
{
while (fileContents.Peek() >= 0)
{
string record = fileContents.ReadLine();
//Order order = JsonConvert.DeserializeObject<Order>(record);
Order order = JsonConvert.DeserializeObject<List<Order>>(record); //this is failing
OrderOutputBuffer.AddRow();
OrderOutputBuffer.OrderID = order.OrderID;
OrderOutputBuffer.CustomerID = order.CustomerID;
OrderOutputBuffer.OrderDate = order.OrderDate;
foreach (OrderLine orderline in order.OrderLine)
{
OrderLineOutputBuffer.AddRow();
OrderLineOutputBuffer.OrderID = order.OrderID;
OrderLineOutputBuffer.OrderLineID = orderline.OrderLineID;
OrderLineOutputBuffer.ProductID = orderline.ProductID;
OrderLineOutputBuffer.Units = orderline.Units;
OrderLineOutputBuffer.ClientID = orderline.ClientID;
}
}
}
}
public class Order
{
public int OrderID { get; set; }
public int CustomerID { get; set; }
public DateTime OrderDate { get; set; }
public OrderLine[] OrderLine { get; set; }
}
public class OrderLine
{
public int OrderLineID { get; set; }
public int ProductID { get; set; }
public int Units { get; set; }
public int ClientID { get; set; }
}
}
Thanks!
I fixed this in the end:
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
string json = File.ReadAllText("Z:\\DataTech Test\\Data\\Orders_20200720.json");
var records = JsonConvert.DeserializeObject<List<Order>>(json);
foreach (var r in records)
{
OrderOutputBuffer.AddRow();
OrderOutputBuffer.OrderID = r.OrderID;
OrderOutputBuffer.CustomerID = r.CustomerID;
OrderOutputBuffer.OrderDate = r.OrderDate;
foreach (OrderLine orderline in r.OrderLine)
{
OrderLineOutputBuffer.AddRow();
OrderLineOutputBuffer.OrderID = r.OrderID;
OrderLineOutputBuffer.OrderLineID = orderline.OrderLineID;
OrderLineOutputBuffer.ProductID = orderline.ProductID;
OrderLineOutputBuffer.Units = orderline.Units;
OrderLineOutputBuffer.NurseryID = orderline.NurseryID;
}
}
}
public class OrderLine
{
public int OrderLineID { get; set; }
public int ProductID { get; set; }
public int Units { get; set; }
public int NurseryID { get; set; }
}
public class Order
{
public int OrderID { get; set; }
public int CustomerID { get; set; }
public DateTime OrderDate { get; set; }
public List<OrderLine> OrderLine { get; set; }
}
public class Root
{
public List<Order> Order { get; set; }
}
}
Finding the right title for this problem was kinda hard so I'll try to explain the problem a bit better below.
I am making a call to an API which returns the following JSON object:
{{
"id": "jsonrpc",
"jsonrpc": "2.0",
"result": {
"result": [
{
"AccountId": 285929,
"Flags": [
"Managed_Obsolete"
],
"PartnerId": 73560,
"Settings": [
{
"AN": "company_1"
},
{
"CD": "1435323320"
},
{
"ED": "2147483647"
},
{
"OS": "Windows Server 2012 R2 Standard Edition (9600), 64-bit"
},
{
"OT": "2"
},
{
"T3": "1085792125772"
},
{
"US": "958222150780"
},
{
"YS": "100"
}
]
},
{
"AccountId": 610474,
"Flags": null,
"PartnerId": 249262,
"Settings": [
{
"AN": "company_2"
},
{
"CD": "1522143635"
},
{
"ED": "2147483647"
},
{
"OS": "Windows 7 Professional Service Pack 1 (7601), 64-bit"
},
{
"OT": "2"
},
{
"T3": "598346102236"
},
{
"US": "758149148249"
},
{
"YS": "100"
}
]
},
],
"totalStatistics": null
},
}}
In above result I listed only the first 2 accounts (total of 80+ accounts normally).
Deserializing the object works fine, I am putting the JSON object fields inside my C# model (list).
The problem however is that I can't get the (inner) Settings array properly in my model. The settings array keys are unknown, I define these keys when I call the API:
JObject requestObject = new JObject();
requestObject.Add(new JProperty("id", "jsonrpc"));
requestObject.Add(new JProperty("jsonrpc", "2.0"));
requestObject.Add(new JProperty("method", "myMethod"));
requestObject.Add(new JProperty("visa", someID));
requestObject.Add(new JProperty("params",
new JObject(
new JProperty("query", new JObject(
new JProperty("PartnerId", partnerId),
new JProperty("StartRecordNumber", 0),
new JProperty("RecordsCount", 9999999),
new JProperty("Columns", new JArray("AR", "AN", "US", "T3", "OT", "OS", "YS"))
)),
new JProperty("timeslice", unixDate),
new JProperty("totalStatistics", "*")
))
);
In above call I define the keys for the Settings array, this could however also be just one key or more. For this reason I want to make my Settings property in my C# model generic (I don't want to list all the possible key names because this are over 100 keys).
What I had so far:
List<EnumerateAccountHistoryStatisticsResult> resultList = new List<EnumerateAccountHistoryStatisticsResult>();
var result = JsonConvert.DeserializeObject<JObject>(streamreader.ReadToEnd());
dynamic innerResult = result["result"]["result"];
foreach (var obj in innerResult)
{
resultList.Add(
new EnumerateAccountHistoryStatisticsResult
{
AccountId = obj.AccountId,
Flags = obj.Flags.ToObject<IEnumerable<string>>(),
PartnerId = obj.PartnerId,
Settings = obj.Settings.ToObject<List<ColumnSettingsResult>>(),
});
}
The EnumerateAccountHistoryStatisticsResult Model:
public class EnumerateAccountHistoryStatisticsResult
{
public int AccountId { get; set; }
public IEnumerable<string> Flags { get; set; }
public int PartnerId { get; set; }
public List<ColumnSettingsResult> Settings { get; set; }
}
The ColumnSettingsResult model:
public class ColumnSettingsResult
{
public string AR { get; set; }
public string AN { get; set; }
public string US { get; set; }
public string T3 { get; set; }
public string OT { get; set; }
public string OS { get; set; }
public string YS { get; set; }
// and list all other columns...
}
With above models I would need to list all the possible columns which are over 100 properties, besides that the result of the Settings list is not logical because I get all the property values but for each different key I get null values:
The ColumnSettingsResult model should more be something like:
public class ColumnSettingsResult
{
public string ColumnName { get; set; }
public string ColumnValue { get; set; }
}
I cant get the key and value inside these two properties though without defining the key name inside the model..
I already tried several things without result (links below as reference).
Anyone that can get me in the right direction?
C# deserialize Json unknown keys
Convert JObject into Dictionary<string, object>. Is it possible?
Convert Newtonsoft.Json.Linq.JArray to a list of specific object type
Try making Settings of type Dictionary<string,string> (or List<KeyValuePair<string,string>> if Dictionary doesn't give you what you want.
public class MyJsonObject
{
public string id { get; set; }
public string jsonrpc { get; set; }
public Result result { get; set; }
public class Result2
{
public int AccountId { get; set; }
public List<string> Flags { get; set; }
public int PartnerId { get; set; }
public Dictionary<string,string> Settings { get; set; } //or List<KeyValuePair<string,string>>
}
public class Result
{
public List<Result2> result { get; set; }
public object totalStatistics { get; set; }
}
}
Then JsonConvert.DerserializeObject<MyJsonObject>(jsonString);
I am familiar with JSON.net a bit and can Deserialize the JSON with basic structure (upto one child). I am currently in process of Deserializing the JSON that is returned from Netatmo API. The structure of JSON is complicated for me. Following is the basic structure of the JSON,
_id
place
location
Dynamic Value 1
Dynamic Value2
altitude
timezone
mark
measures
Dynamic Value 1
res
Dynamic Value 1
Dynamic Value 1
Dynamic Value 2
type
Dynamic Value 1
Dynamic Value 2
modules
Dynamic Value 1
Dynamic Value 1 and Dynamic Value 2 represents the values that is changed for each id. The complete JSON is given below,
{
"body": [{
"_id": "70:ee:50:02:b4:8c",
"place": {
"location": [-35.174779762001, -5.8918476117544],
"altitude": 52,
"timezone": "America\/Fortaleza"
},
"mark": 0,
"measures": {
"02:00:00:02:ba:2c": {
"res": {
"1464014579": [16.7, 77]
},
"type": ["temperature", "humidity"]
},
"70:ee:50:02:b4:8c": {
"res": {
"1464014622": [1018.1]
},
"type": ["pressure"]
}
},
"modules": ["02:00:00:02:ba:2c"]
}, {
"_id": "70:ee:50:12:40:cc",
"place": {
"location": [-16.074257294385, 11.135715243973],
"altitude": 14,
"timezone": "Africa\/Bissau"
},
"mark": 14,
"measures": {
"02:00:00:06:7b:c8": {
"res": {
"1464015073": [26.6, 78]
},
"type": ["temperature", "humidity"]
},
"70:ee:50:12:40:cc": {
"res": {
"1464015117": [997]
},
"type": ["pressure"]
}
},
"modules": ["02:00:00:06:7b:c8"]
}],
"status": "ok",
"time_exec": 0.010364055633545,
"time_server": 1464015560
}
I am confused by looking at the complex structure of this JSON. For single level of JSON I have used this code in the past,
IList<lstJsonAttributes> lstSearchResults = new List<lstJsonAttributes>();
foreach (JToken objResult in objResults) {
lstJsonAttributes objSearchResult = JsonConvert.DeserializeObject<lstJsonAttributes>(objResult.ToString());
lstSearchResults.Add(objSearchResult);
}
But for so many child I have yet to understand how the object class will be created. Any guidance will highly appreciated.
Update:
This is what I have achieved so far.
I have created a main class as below,
public class PublicDataClass
{
public string _id { get; set; }
public PublicData_Place place { get; set; }
public string mark { get; set; }
public List<string> modules { get; set; }
}
and "Place" class is as follow,
public class PublicData_Place
{
public List<string> location { get; set; }
public string altitude { get; set; }
public string timezone { get; set; }
}
Then I have Deserialized the object in the following code line,
var obj = JsonConvert.DeserializeObject<List<PublicDataClass>>(jsonString);
I can now successfully get all the data except the "measures" which is little bit more complicated.
Using json.net, JSON objects that have arbitrary property names but fixed schemas for their values can be deserialized as a Dictionary<string, T> for an appropriate type T. See Deserialize a Dictionary for details. Thus your "measures" and "res" objects can be modeled as dictionaries.
You also need a root object to encapsulate your List<PublicDataClass>, since your root JSON container is an object like so: { "body": [{ ... }] }.
Thus you can define your classes as follows:
public class RootObject
{
public List<PublicDataClass> body { get; set; }
public string status { get; set; }
public double time_exec { get; set; }
public int time_server { get; set; }
}
public class PublicDataClass
{
public string _id { get; set; }
public PublicData_Place place { get; set; }
public int mark { get; set; }
public List<string> modules { get; set; }
public Dictionary<string, Measure> measures { get; set; }
}
public class PublicData_Place
{
public List<double> location { get; set; } // Changed from string to double
public double altitude { get; set; } // Changed from string to double
public string timezone { get; set; }
}
public class Measure
{
public Measure()
{
this.Results = new Dictionary<string, List<double>>();
this.Types = new List<string>();
}
[JsonProperty("res")]
public Dictionary<string, List<double>> Results { get; set; }
[JsonProperty("type")]
public List<string> Types { get; set; }
}
Then do
var root = JsonConvert.DeserializeObject<RootObject>(jsonString);
var obj = root.body;
I've worked with XML for a few years and my change to JSON structure I've got a little confused too, always that I want to see how an object look like I use this web site jsoneditoronline Just copy and paste your JSON and click on arrow to parse to an object, I hope it helps until you get used to JSON structure.
I am using Unity and the Facebook SDK.
Currently I am retrieving a list of users friends who have the app installed using the graph API:
The data when it is returned looks as such:
{
"data": [
{
"installed": true,
"id": "1292282928282"
},
{
"installed": true,
"id": "29282829292"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.5/105157539862931/friends?fields=installed&format=json&access_token=CAALVPHznNpcBAOnO94HvqUgYKI2kObPZBgR0sqIOMSRO9swZBBTWHb6FjliZCT1KyCmPbnX42xvtngboh3DjFOrixw0pSenwRZA1oXZAHNDdYcGsHNOHjQcZB0f6fsZBQJjhOTttwQu7E5hZBDcAWJVZBGK2AxrZBDZBxLL7I5pjXwwbb12hDytZAiVzUmNzi1Ae2CCvOnL6QCpqzsJT7fWWjXXi&limit=25&offset=25&__after_id=enc_AdB7PJbXYkDSSZAq33AjPXZAeRnlrZBDwjAAILZAg3emHdei0qdRLa2AeD6sRuX6h0OQuPQi8x8bvSHPy0EqIgybYL89"
},
"summary": {
"total_count": 2
}
}
Currently I am trying to figure out how I can extract the "Installed" and id from each object inside of the "data" object.
so far I am doing this:
Dictionary<object,object> friendsList = Json.Deserialize (result.RawResult) as Dictionary<object,object>;
But I am not sure how I can pull out these specific items from the objects.
Does anyone know how I would go about doing this?
You need to have classes that will hold the deserialized data for you. For example create the following classes:
public class Datum
{
public bool installed { get; set; }
public string id { get; set; }
}
public class Paging
{
public string next { get; set; }
}
public class Summary
{
public int total_count { get; set; }
}
public class RootObject
{
public List<Datum> data { get; set; }
public Paging paging { get; set; }
public Summary summary { get; set; }
}
RootObject is the root class so the deserialization code will be:
var deserialized = Json.Deserialize<RootObject>(result.RawResult);
There is one more way to do it without creating classes, by using the dynamic keyword:
static void Main(string[] args)
{
var stringVal = #"{
""data"": [
{
""installed"": true,
""id"": ""1292282928282""
},
{
""installed"": true,
""id"": ""29282829292""
}
],
""paging"": {
""next"": ""https://graph.facebook.com/v2.5/105157539862931/friends? fields=installed&format=json&access_token=CAALVPHznNpcBAOnO94HvqUgYKI2kObPZBgR0sqIOMSRO9swZBBTWHb6FjliZCT1KyCmPbnX42xvtngboh3DjFOrixw0pSenwRZA1oXZAHNDdYcGsHNOHjQcZB0f6fsZBQJjhOTttwQu7E5hZBDcAWJVZBGK2AxrZBDZBxLL7I5pjXwwbb12hDytZAiVzUmNzi1Ae2CCvOnL6QCpqzsJT7fWWjXXi&limit=25&offset=25&__after_id=enc_AdB7PJbXYkDSSZAq33AjPXZAeRnlrZBDwjAAILZAg3emHdei0qdRLa2AeD6sRuX6h0OQuPQi8x8bvSHPy0EqIgybYL89""
},
""summary"": {
""total_count"": 2
}
}";
dynamic x = JsonConvert.DeserializeObject(stringVal);
var data = x.data;
foreach(var d in data)
{
bool installed = d.installed;
long id = d.id;
// todo: use the id and installed
}
Run this in Linqpad and you it will return the installed property.
void Main()
{
string jsonText =
#"{
""data"": [
{
""installed"": true,
""id"": ""1292282928282""
},
{
""installed"": true,
""id"": ""29282829292""
}
],
""paging"": {
""next"": ""https://graph.facebook.com/v2.5/105157539862931/friends?fields=installed&format=json&access_token=CAALVPHznNpcBAOnO94HvqUgYKI2kObPZBgR0sqIOMSRO9swZBBTWHb6FjliZCT1KyCmPbnX42xvtngboh3DjFOrixw0pSenwRZA1oXZAHNDdYcGsHNOHjQcZB0f6fsZBQJjhOTttwQu7E5hZBDcAWJVZBGK2AxrZBDZBxLL7I5pjXwwbb12hDytZAiVzUmNzi1Ae2CCvOnL6QCpqzsJT7fWWjXXi&limit=25&offset=25&__after_id=enc_AdB7PJbXYkDSSZAq33AjPXZAeRnlrZBDwjAAILZAg3emHdei0qdRLa2AeD6sRuX6h0OQuPQi8x8bvSHPy0EqIgybYL89""
},
""summary"": {
""total_count"": 2
}
}";
var x = JsonConvert.DeserializeObject<Response>(jsonText);
//To Get installed
x.data.Select(d => d.installed).Dump();
}
public class Response
{
public Data[] data;
public Paging paging;
public Summary summary;
}
public class Data
{
public bool installed { get; set; }
public string id { get; set; }
}
public class Paging
{
public string next { get; set; }
}
public class Summary
{
public int total_count { get; set;}
}
Consults this example for obtain a friend list using mini json:https://developers.facebook.com/docs/unity/reference/current/Json