Hi nauna,
Please import Newtonsoft.Json dll file.
Please refer below sample.
Json
{
"shopItems": [
{
"id": 36007,
"twitch": true,
"discord": true,
"slack": true,
"mixer": true,
"youtube": true,
"facebook": true,
"dlive": true,
"trovo": true,
"brime": true,
"tiktok": true,
"twitter": false,
"zoom": false,
"brimeConnectionId": null,
"dliveConnectionId": null,
"facebookConnectionId": null,
"mixerConnectionId": null,
"tiktokConnectionId": null,
"trovoConnectionId": null,
"twitchConnectionId": null,
"youtubeConnectionId": null,
"name": "Product Name",
"description": "Product Description\n",
"price": 30000,
"order": 0,
"key": "cooler",
"response": "Thank You",
"quantity": 10,
"userLevel": 0,
"loyaltyTierId": null,
"enabled": true,
"shippingRequired": true,
"resourceId": 19268,
"soundResourceId": null,
"accountId": null,
"guildId": 46,
"campaignId": null,
"createdAt": "2022-12-22T09:01:45.000Z",
"updatedAt": "2022-12-22T09:01:45.000Z",
"tags": []
}
]
}
HTML
<table>
<tr>
<th>resourceId</th>
<th>name</th>
<th>description</th>
<th>price</th>
<th>key</th>
<th>response</th>
<th>quantity</th>
</tr>
<asp:ListView runat="server" ID="lvDetails">
<ItemTemplate>
<tr>
<td><%# Eval("resourceId") %></td>
<td><%# Eval("name") %></td>
<td><%# Eval("description") %></td>
<td><%# Eval("price") %></td>
<td><%# Eval("key") %></td>
<td><%# Eval("response") %></td>
<td><%# Eval("quantity") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
</table>
Namespaces
C#
using System.IO;
using Newtonsoft.Json;
VB.Net
Imports System.IO
Imports Newtonsoft.Json
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
Root root = JsonConvert.DeserializeObject<Root>(File.ReadAllText(Server.MapPath("~/json.json")));
lvDetails.DataSource = root.shopItems;
lvDetails.DataBind();
}
public class Root
{
public List<ShopItem> shopItems { get; set; }
}
public class ShopItem
{
public int id { get; set; }
public string twitch { get; set; }
public string discord { get; set; }
public string slack { get; set; }
public string mixer { get; set; }
public string youtube { get; set; }
public string facebook { get; set; }
public string dlive { get; set; }
public string trovo { get; set; }
public string brime { get; set; }
public string tiktok { get; set; }
public string twitter { get; set; }
public string zoom { get; set; }
public string brimeConnectionId { get; set; }
public string dliveConnectionId { get; set; }
public string facebookConnectionId { get; set; }
public string mixerConnectionId { get; set; }
public string tiktokConnectionId { get; set; }
public string trovoConnectionId { get; set; }
public string twitchConnectionId { get; set; }
public string youtubeConnectionId { get; set; }
public string name { get; set; }
public string description { get; set; }
public string price { get; set; }
public int order { get; set; }
public string key { get; set; }
public string response { get; set; }
public int quantity { get; set; }
public int userLevel { get; set; }
public string loyaltyTierId { get; set; }
public string enabled { get; set; }
public string shippingRequired { get; set; }
public int resourceId { get; set; }
public string soundResourceId { get; set; }
public string accountId { get; set; }
public int guildId { get; set; }
public string campaignId { get; set; }
public string createdAt { get; set; }
public string updatedAt { get; set; }
public Tags[] tags { get; set; }
}
public class Tags
{
public string tag { get; set; }
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim root As Root = JsonConvert.DeserializeObject(Of Root)(File.ReadAllText(Server.MapPath("~/json.json")))
lvDetails.DataSource = root.shopItems
lvDetails.DataBind()
End Sub
Public Class Root
Public Property shopItems As List(Of ShopItem)
End Class
Public Class ShopItem
Public Property id As Integer
Public Property twitch As String
Public Property discord As String
Public Property slack As String
Public Property mixer As String
Public Property youtube As String
Public Property facebook As String
Public Property dlive As String
Public Property trovo As String
Public Property brime As String
Public Property tiktok As String
Public Property twitter As String
Public Property zoom As String
Public Property brimeConnectionId As String
Public Property dliveConnectionId As String
Public Property facebookConnectionId As String
Public Property mixerConnectionId As String
Public Property tiktokConnectionId As String
Public Property trovoConnectionId As String
Public Property twitchConnectionId As String
Public Property youtubeConnectionId As String
Public Property name As String
Public Property description As String
Public Property price As String
Public Property order As Integer
Public Property key As String
Public Property response As String
Public Property quantity As Integer
Public Property userLevel As Integer
Public Property loyaltyTierId As String
Public Property enabled As String
Public Property shippingRequired As String
Public Property resourceId As Integer
Public Property soundResourceId As String
Public Property accountId As String
Public Property guildId As Integer
Public Property campaignId As String
Public Property createdAt As String
Public Property updatedAt As String
Public Property tags As Tags()
End Class
Public Class Tags
Public Property tag As String
End Class
Screenshot