I am trying to build a api-based online currency program for School Project. I did it but I am trying to build a more functional program so I decided to add a second windows form to my program. This second form does currency exchange in past time. The api that I used in my project can do it so it is possible to do but in VB when I try to get currency names in dictionary I get an error like this:
'Newtonsoft.Json.JsonReaderException' türünde bir yakalanamayan özel durum, Newtonsoft.Json.dll öğesinde oluştu Unexpected character encountered while parsing value: {. Path 'rates', line 1, position 43.
And this is my code:
Dim rawResp As String
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim jsonResultToDict As Dictionary(Of String, String)
Dim kurlar As String
Dim kur As Object
Dim kurs As String
request = DirectCast(WebRequest.Create("http://api.fixer.io/" + DateTimePicker1.Value.ToString("yyyy-MM-dd")), HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
reader = New StreamReader(response.GetResponseStream())
rawResp = reader.ReadToEnd
jsonResultToDict = JsonConvert.DeserializeObject(Of Dictionary(Of String, String))(rawResp)
kurlar = jsonResultToDict.Item("rates")
kur = JObject.Parse(kurlar)
By the way I didn't try to set currency names in combobox yet because I couldn't get the data for now.
This is the api : http://fixer.io/
Thanks for helping...