Hi nauna,
Check this example. Now please take its reference and correct your code.
For this i have used JSON.Net library. You can download from the following URL.
Download JSON.Net
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string url = "https://free.currencyconverterapi.com/api/v6/convert?apiKey=57313b824a42f841f02c&q=USD_PKR&compact=y";
System.Net.WebClient client = new System.Net.WebClient();
string rates = client.DownloadString(url);
var dictResult = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(rates);
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + dictResult["USD_PKR"]["val"] + "');", true);
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim url As String = "https://free.currencyconverterapi.com/api/v6/convert?apiKey=57313b824a42f841f02c&q=USD_PKR&compact=y"
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim rates As String = client.DownloadString(url)
Dim dictResult = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Dictionary(Of String, Dictionary(Of String, String)))(rates)
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('" & dictResult("USD_PKR")("val") & "');", True)
End If
End Sub
Screenshot