February 2, 2017 at 1:25 pm
Since data in JSON format is returned. you can try to use RestSharp (RestSharp.dll) and Newtonsoft.Json. (free download somewhere, Newtonsoft.Json.dll). which can help you to manipulate JSON data easily.
>>sample of code>>
Dim Client as RestClient = New RestClient("http://url...")
Dim yourRequest As RestRequest = new RestRequest("put parameters for url here", Method.GET)
Client.Authenticator = New HttpBasicAuthenticator(UserName, Password) 'if need to authenticate
Dim yourResponse As IRestResponse = Client.Execute(yourRequest)
Dim dataJSON As yourDataClass = JsonConvert.DeserializeObject(Of yourDataClass)(yourResponse.Content)
' then you can start to use dataJSON.id, dataJSON.valueofid to get data...
>>>>>>
Public Class yourDataClass
<JsonProperty(PropertyName:="id")> ' *** "id", "valueofid" must be same as property names in JSON file, you may read help file on how to use the tool of Newtonsoft.Json
Public Property id As Integer
<JsonProperty(PropertyName:="valueofid")>
Public Property self As String
End Class
>>>>>>
February 2, 2017 at 1:34 pm
<JsonProperty(PropertyName:="valueofid")>
Public Property valueofid As String 'Correction here, should be "valueofid", instead of name "self"
End Class
>>>>>>
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply