1

this is the code i have, dim sline from string to json, i have try it and search on google, but i havent done yet...

please help

Dim sURL As String
sURL = TextBox1.Text
Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
Dim myProxy As New WebProxy("myproxy", 80)
myProxy.BypassProxyOnLocal = True

wrGETURL.Proxy = myProxy

wrGETURL.Proxy = WebProxy.GetDefaultProxy()
Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0

Do While Not sLine Is Nothing
    i += 1
    sLine = objReader.ReadLine
    If Not sLine Is Nothing Then
        Console.WriteLine("{0}:{1}", i, sLine)
    End If
Loop
Dim respon As Array = sLine.ToArray()
Console.ReadLine()
Console.WriteLine(respon("traceNo"))
Console.ReadLine()

i want to convert the Dim sline to json, how it possible?

1 Answer 1

3

Newtonsoft.JSON is a VERY handy NuGet to easy use JSON in VB.Net.

Seperate your lines into a List(Of Integer, String) (i,sLine) and Serialize it with

Dim yourJSONString = JsonConvert.SerializeObject(yourList)
Sign up to request clarification or add additional context in comments.

3 Comments

failed to install that package on my visual studio
If it fails to install just a NuGet, than you should repair your visual studio first
@Kenzie Which version of Visual Studio are you using?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.