I would like to import a JSON returned from one brazilian zip code webservice. My Xojo code is:
[code]Dim Socket As New HTTPSocket
Dim result As String
Dim jsonData As Text
Socket.SetRequestContent("", “application/json; charset=utf-8”)
result = Socket.get(“viacep.com.br/ws/29042765/json/”, 30)
jsonData = DefineEncoding(result, Encodings.UTF8).ToText
Dim d As Xojo.Core.Dictionary
d = Xojo.Data.ParseJSON(jsonData)
Dim theAdress As Xojo.Core.Dictionary = d.Value(1)
Dim cep As Text = theAdress.Value(“cep”)
Dim logradouro As Text = theAdress.Value(“logradouro”)[/code]
the JSON received from webservice is:
{
"cep": "01001-000",
"logradouro": "Praa da S",
"complemento": "lado mpar",
"bairro": "S",
"localidade": "So Paulo",
"uf": "SP",
"unidade": "",
"ibge": "3550308",
"gia": "1004"
}
My code doesn’t work, with many erros. Could someone help-me?