Hi mehmetaskar,
Create a class based on the JSON data and Deserialize it.
Refer below example.
JS file Data
Following the JSON file data.
{
"js": [
{
"id": "*",
"title": "All",
"alias": "All",
"active_sub": true,
"censored": 0
},
{
"id": "1",
"title": "TR | TÜRKİYE",
"modified": "",
"number": 1,
"alias": "tr | türki̇ye",
"censored": 0
},
{
"id": "2",
"title": "TR | AVRUPA & YEREL",
"modified": "",
"number": 2,
"alias": "tr | avrupa & yerel",
"censored": 0
},
{
"id": "3",
"title": "TR | HABER",
"modified": "",
"number": 3,
"alias": "tr | haber",
"censored": 0
},
{
"id": "7",
"title": "TR | BELGESEL",
"modified": "",
"number": 4,
"alias": "tr | belgesel",
"censored": 0
},
{
"id": "4",
"title": "TR | ÇOCUK",
"modified": "",
"number": 5,
"alias": "tr | çocuk",
"censored": 0
},
{
"id": "1088",
"title": "TR | ÇOCUK 24/7",
"modified": "",
"number": 6,
"alias": "tr | çocuk 24/7",
"censored": 0
},
{
"id": "1131",
"title": "TR | SİNEMA & EĞLENCE 7/24",
"modified": "",
"number": 7,
"alias": "tr | si̇nema & eğlence 7/24",
"censored": 0
},
{
"id": "1220",
"title": "TR | LYNX DİZİLER 7/24",
"modified": "",
"number": 8,
"alias": "tr | lynx di̇zi̇ler 7/24",
"censored": 0
},
{
"id": "10",
"title": "TR | BEIN & D-SMART SİNEMA",
"modified": "",
"number": 9,
"alias": "tr | bein & d-smart si̇nema",
"censored": 0
},
{
"id": "6",
"title": "TR | SPOR",
"modified": "",
"number": 10,
"alias": "tr | spor",
"censored": 0
},
{
"id": "5",
"title": "TR | BEIN SPORTS",
"modified": "",
"number": 11,
"alias": "tr | bein sports",
"censored": 0
},
{
"id": "8",
"title": "TR | MÜZİK",
"modified": "",
"number": 12,
"alias": "tr | müzi̇k",
"censored": 0
},
{
"id": "9",
"title": "TR | DİNİ",
"modified": "",
"number": 13,
"alias": "tr | di̇ni̇",
"censored": 0
},
{
"id": "1161",
"title": "NL | NEDERLAND UHD",
"modified": "",
"number": 14,
"alias": "nl | nederland uhd",
"censored": 0
},
{
"id": "23",
"title": "NL | NEDERLAND",
"modified": "",
"number": 15,
"alias": "nl | nederland",
"censored": 0
},
{
"id": "28",
"title": "NL | DOCU & REALITY",
"modified": "",
"number": 16,
"alias": "nl | docu & reality",
"censored": 0
},
{
"id": "25",
"title": "NL | KIDS",
"modified": "",
"number": 17,
"alias": "nl | kids",
"censored": 0
},
{
"id": "1115",
"title": "NL | KIDS 24/7",
"modified": "",
"number": 18,
"alias": "nl | kids 24/7",
"censored": 0
},
{
"id": "572",
"title": "NL | MUZIEK",
"modified": "",
"number": 19,
"alias": "nl | muziek",
"censored": 0
},
{
"id": "26",
"title": "NL | CINEMA",
"modified": "",
"number": 20,
"alias": "nl | cinema",
"censored": 0
},
{
"id": "27",
"title": "NL | SPORT",
"modified": "",
"number": 21,
"alias": "nl | sport",
"censored": 0
},
{
"id": "573",
"title": "NL | VIAPLAY DUTCH",
"modified": "",
"number": 22,
"alias": "nl | viaplay dutch",
"censored": 0
},
{
"id": "1313",
"title": "NL | PPV & EVENTS",
"modified": "",
"number": 23,
"alias": "nl | ppv & events",
"censored": 0
},
{
"id": "24",
"title": "NL | REGIONAAL",
"modified": "",
"number": 24,
"alias": "nl | regionaal",
"censored": 0
},
{
"id": "1066",
"title": "NL | BUITENLAND",
"modified": "",
"number": 25,
"alias": "nl | buitenland",
"censored": 0
},
{
"id": "1002",
"title": "F1 | FORMULE 1",
"modified": "",
"number": 26,
"alias": "f1 | formule 1",
"censored": 0
},
{
"id": "1312",
"title": "WO | WORLDSPORT",
"modified": "",
"number": 27,
"alias": "wo | worldsport",
"censored": 0
},
{
"id": "1068",
"title": "BE | BELGIUM",
"modified": "",
"number": 28,
"alias": "be | belgium",
"censored": 0
},
{
"id": "1069",
"title": "BE | SPORTS",
"modified": "",
"number": 29,
"alias": "be | sports",
"censored": 0
}
]
}
Code
C#
private void Form1_Load(object sender, EventArgs e)
{
string json = System.IO.File.ReadAllText("D:\\Files\\json.json");
dataGridView1.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject<Root>(json).js;
}
public class Movie
{
public string id { get; set; }
public string title { get; set; }
//public string alias { get; set; }
//public bool active_sub { get; set; }
//public int censored { get; set; }
//public string modified { get; set; }
//public int? number { get; set; }
}
public class Root
{
public List<Movie> js { get; set; }
}
VB.Net
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim json As String = System.IO.File.ReadAllText("D:\Files\json.json")
DataGridView1.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Root)(json).js
End Sub
Public Class Movie
Public Property id As String
Public Property title As String
'Public Property [alias] As String
'Public Property active_sub As Boolean
'Public Property censored As Integer
'Public Property modified As String
'Public Property number As Integer?
End Class
Public Class Root
Public Property js As List(Of Movie)
End Class
Screenshot