Read JSON data from URL using C# and VB.Net in ASP.Net

Last Reply 3 months ago By pandeyism

Posted 3 months ago

How can i convert this code to asp.net vb

{
    string json = new System.Net.WebClient().DownloadString("http://static.social.ndtv.com/files/blanket-jk-count.json");
    string count = json.Split(':')[1].Replace("}", "");

 

You are viewing reply posted by: pandeyism 3 months ago.
Posted 3 months ago

Hey makumbi,

Please refer below code.

Code

C#

protected void Page_Load(object sender, EventArgs e)
{
    string json = new System.Net.WebClient().DownloadString("http://static.social.ndtv.com/files/blanket-jk-count.json");
    string count = json.Split(':')[1].Replace("}", "");
}

VB.Net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim json As String = New System.Net.WebClient().DownloadString("http://static.social.ndtv.com/files/blanket-jk-count.json")
    Dim count As String = json.Split(":"c)(1).Replace("}", "")
End Sub