Hi all,
Solved at post reply.
Thx
I did write a script that let me grab some json data, but there is one thing i dont know why it won't want to work.
When i enter "lat" it works but not "house_number"
This is the json site
This is my script :
If i use this hs.WriteLog("Value of device", obj.item("lat").Tostring) it writes out the latitude perfectly.
but when i wat to use hs.WriteLog("Value of device", obj.item("house_number").Tostring) it writes an error in homeseer :
Did i forget something ?
regards
Solved at post reply.
Thx
I did write a script that let me grab some json data, but there is one thing i dont know why it won't want to work.
When i enter "lat" it works but not "house_number"
This is the json site
Code:
{"place_id":"164848013","licence":"API © LocationIQ.org CC BY 4.0, Data © testers, ODbL 1.0","osm_type":"way","osm_id":"437411681","lat":"17.42122785","lon":"78.4006673","display_name":"128, Road No 15, Prashasan Nagar, Hyderabad, Telangana, 500033, India","address":{"house_number":"128","road":"Road No 15","suburb":"Prashasan Nagar","city":"Hyderabad","state_district":"Hyderabad","state":"Telangana","postcode":"500033","country":"India","country_code":"in"},"boundingbox":["17.421132","17.4213237","78.4005923","78.4007423"]}
Code:
Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Sub Main (params as Object) Try Dim DataStr As String = hs.GetURL("http://test.org","/v1/reverse.php?format=json&key=mykey&lat=17.421223&lon=78.400674",true,80) Dim obj As New Object Dim JSON As String = DataStr dim json2 as string JSON2 = JSON.replace("""","") JSON2 = JSON.replace("©","") Dim SplitStr() As String = JSON.Split(",") Dim CurrentString As String Dim DPosition As Integer Dim StringToWorkWith As String obj = JsonConvert.DeserializeObject(json2) hs.WriteLog("Value of device", obj.item("lat").Tostring) Catch ex As Exception hs.writelog("JSON", "Exception: " & ex.message) End Try end sub
but when i wat to use hs.WriteLog("Value of device", obj.item("house_number").Tostring) it writes an error in homeseer :
Code:
JSON Exception: Object reference not set to an instance of an object.
regards
Comment