Jeffrey George
asked on
Deserialize Json result
Hi
I am working on an application to access data via API using VB.NET.
I have so far managed to request for and retrieve a security token in the format as shown below:
{"success":true,"token":"e yJhbGciOiJ IUzI1NiIsI mNhbGciOiJ ERUYifQ.eN qqVkpOyc9N zMxTslLKTc xJrCzOTDRU 0lFKrShQsj I0tTACYjNT 01oAAAAA__ 8.ElaYAGRs AV43lh2OyQ 4eR1wF4UIK l7tpHS7YFa mVGD8"}
I need to retrieve the "token" value and use that to access the server and request specific information.
I have created a class
Public Class SecurityToken
<JsonProperty("success")>
Public Property Success As String
<JsonProperty("token")>
Public Property Token As String()
End Class
And in my code, I successfully get to this point where I get the result as shown above
Dim dataStream As Stream = response.GetResponseStream ()
Dim reader As StreamReader = New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
I am stuck at this point in trying to split the result and retrieve just the token to use in further processing.
Any help would be appreciate.
Thank you.
I am working on an application to access data via API using VB.NET.
I have so far managed to request for and retrieve a security token in the format as shown below:
{"success":true,"token":"e
I need to retrieve the "token" value and use that to access the server and request specific information.
I have created a class
Public Class SecurityToken
<JsonProperty("success")>
Public Property Success As String
<JsonProperty("token")>
Public Property Token As String()
End Class
And in my code, I successfully get to this point where I get the result as shown above
Dim dataStream As Stream = response.GetResponseStream
Dim reader As StreamReader = New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
I am stuck at this point in trying to split the result and retrieve just the token to use in further processing.
Any help would be appreciate.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Coool, glad that it worked.
ASKER
Pleasure to meet you, and thank you very much, your solution worked.
Have a good day!
Regards
Jeffrey