Hey makumbi,
Please refer below sample.
Namespaces
C#
using System.IO;
VB.Net
Imports System.IO
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string json = File.ReadAllText(Server.MapPath("~/JSon.txt"));
string[] values = json.Replace("\"[{", "").Replace("}]\"", "").Replace("\"", "").Split(',');
Dictionary<string, string> dic = new Dictionary<string, string>();
foreach (var item in values)
{
dic.Add(item.Split(':')[0], item.Split(':')[1]);
}
string customerId = dic["CustomerId"];
string comments = dic["Comments"];
Response.Write("CustomerId is <b>" + customerId + "</b><br/>comments is <b>" + comments + "</b>");
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim json As String = File.ReadAllText(Server.MapPath("~/JSon.txt"))
Dim values As String() = json.Replace("""[{", "").Replace("}]""", "").Replace("""", "").Split(","c)
Dim dic As Dictionary(Of String, String) = New Dictionary(Of String, String)()
For Each item In values
dic.Add(item.Split(":"c)(0), item.Split(":"c)(1))
Next
Dim customerId As String = dic("CustomerId")
Dim comments As String = dic("Comments")
Response.Write("CustomerId is <b>" & customerId & "</b><br/>comments is <b>" & comments & "</b>")
End Sub
Output
CustomerId is 05-00001
comments is Jana Sports Day Please Come Early