New topic: JSON and Google Maps API
<http://forums.realsoftware.com/viewtopic.php?t=41977> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message willgonz Post subject: JSON and Google Maps APIPosted: Tue Dec 27, 2011 4:50 pm Joined: Thu May 13, 2010 7:27 pm Posts: 123 Whenever I try to use the following code it bombs at the address_Components section. JSON Code:{ "html_attributions" : [], "result" : { "address_components" : [ { "long_name" : "48", "short_name" : "48", "types" : [ "street_number" ] }, { "long_name" : "Pirrama Road", "short_name" : "Pirrama Road", "types" : [ "route" ] }, { "long_name" : "Pyrmont", "short_name" : "Pyrmont", "types" : [ "locality", "political" ] }, { "long_name" : "NSW", "short_name" : "NSW", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "AU", "short_name" : "AU", "types" : [ "country", "political" ] }, { "long_name" : "2009", "short_name" : "2009", "types" : [ "postal_code" ] } ], "formatted_address" : "5/48 Pirrama Road, Pyrmont NSW, Australia", "formatted_phone_number" : "(02) 9374 4000", "geometry" : { "location" : { "lat" : -33.8669710, "lng" : 151.1958750 } }, "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png", "id" : "4f89212bf76dde31f092cfc14d7506555d85b5c7", "international_phone_number" : "+61 2 9374 4000", "name" : "Google Sydney", "rating" : 4.60, "reference" : "CnRlAAAAAfV6JIqSzL8Cf4VnXn0EaI1d5k3IPhdkEonq0MxiUbQFFSVuptVbXbNH4mrevb0bc7G8yWqTUv76i4KTuO_Wf3OrRHjCJJwzQ0mNLjbYGSVqy2eqyrgOUkl6S_sJfTbHzWZYrfPy7KZaet0mM5S6thIQJYuy5v_JD--ZxXEJLWTQRRoU5UaciXBBo89K-bce18Ii9RsEIws", "types" : [ "store", "establishment" ], "url" : "http://maps.google.com/maps/place?cid=10281119596374313554", "vicinity" : "5/48 Pirrama Road, Pyrmont", "website" : "http://www.google.com.au/" }, "status" : "OK" } Here is the RealBasic Code: Code:Dim obj as new JSONItem obj.load(textarea2.text) for i as integer = 0 to obj.Count-1 if obj.IsArray then listbox1.AddRow cstr(i) listbox1.cell(listbox1.LastIndex,1) = obj.Child(i) else dim key as String = obj.Name(i) if obj.value(key) isa JSONItem then listbox1.AddFolder(key) listbox1.RowTag(listbox1.LastIndex) = obj.Value(key) listbox1.Expanded(listbox1.LastIndex) = true else listbox1.AddRow(key) listbox1.cell(listbox1.lastindex,1) = obj.Value(key) end if end if next i What I really want is: address=obj.lookup("street_number","") + " " + obj.lookup("route","") country=obj.lookup("country", "political") etc Thanks Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
