Question Parsing this Json?

stuau

New member
Joined
Dec 1, 2021
Messages
1
Programming Experience
Beginner
Hi All

Need some help with VB.net

just starting off so am a beginner

i have the following json response from an api

JSON:
{
  "4": {
    "name": "Warehouse",
    "tenantcode": "242",
    "package_id": 1,
    "package": "package10",
    "ext_length": 4,
    "country_id": 91,
    "country_code": 61
  },
  "5": {
    "name": "Partners",
    "tenantcode": "240",
    "package_id": 1,
    "package": "package10",
    "ext_length": 4,
    "country_id": 91,
    "country_code": 61
  },
  "8": {
    "name": "Systems",
    "tenantcode": "241",
    "package_id": 20,
    "package": "Systems",
    "ext_length": 4,
    "country_id": 91,
    "country_code": 61
  },


can some one please help with Parsing this json.

am hoping to used the values in a drop down box.

have the below so far, tho not sure how to create the correct class to extract the data
VB.NET:
Imports System.Net
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq



Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click



        Dim json2 As String = (New WebClient).DownloadString("https://myapi")
        Dim json As String = json2

        Dim response = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Object)(json2)

Thanks all
 
Last edited by a moderator:
Back
Top