0

I want to get json from url in google app engine, can u tell me some quite simple methods to do this, thanks, sr my english not good

URL

Content:

{
   "debug_info" : [],
   "html_attributions" : [ "Listings by \u003ca href=\"http://www.diadiem.com/\"\u003eDiadiem.com\u003c/a\u003e" ],
   "next_page_token" : "ClRMAAAAl7MjfntXhFEi33IPPcZJJ5fYfiJzIIGggr9Xc6A_sKeTrjohJntaaG1jWaGYMKiZYruuoqTVipUZFaLhpNXZbhYloN6SeS44epx3lPRdpuMSEHWJTSO2ShwXOz6bjg0xefcaFOUN9wK6NE5Dykjx-x-VLypkBMRH",
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : 16.058660,
               "lng" : 108.2191410
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "7064cb3f44db62207fc2bd83579b63ca9552e658",
         "name" : "Vietcombank - Atm",
         "reference" : "CnRwAAAAHU3y6j7CocExwcFq6DKtkS2SFT-0X23E7C9M7bpHk2EF04ShIX7IRNl9TwGF_APSwaKmk8XSZIGm52ajXnpKhj15i48w0BHmJR0ZamJdIAi3iJD_sExjjHkf5Lnfxq4iLroTAmQyRAoAVG7dMwVeTRIQcO_Qq9N85d96vQCtEdZjyRoUbETiZPHxkSjkbD9CVnQh6N_8yUA",
         "types" : [ "establishment" ],
         "vicinity" : "272 Phan Châu Trinh"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 16.0602490,
               "lng" : 108.21470
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "bd20b9fbd718c13ee3f6d404c3004b649130df4a",
         "name" : "ATM DongA Bank",
         "reference" : "CnRtAAAAP9XTDfjgtqvahglz24j2posRRCR9ry56xyAd0FX810ZeyiKWeEi4Btfnfycb23Sa6x_grdjJszB7Xf80jFBrer9kHYQHsKX2-spx9LHn_yrZxlfC7wxHOdUt9YbYMp71fzQ_SJOC9W1Hj2cHHi9g0BIQPrdWzJvelD1NDEcC49Q8eRoUE0juanyzeZHjyYbnozUGB13RySk",
         "types" : [ "atm", "finance", "establishment" ],
         "vicinity" : "Nguyễn Văn Linh, Da Nang"
      },
bulubuloa
  • 597
  • 1
  • 10
  • 21

2 Answers2

0

Not sure if I got your question correctly, but if you are trying to parse Google's JSON response, a good and easy way to do it may be to use jQuery parseJSON function.

You can also take a look at this answered question to see sample code.

Community
  • 1
  • 1
alevin
  • 1
  • 2
  • I would edit your answer to include relevant code, and further elaborate on a potential solution. – Charlie Jun 08 '13 at 03:38
0

Also, not explicitly stated in the "answered question" link above - you cannot just access the json (or xml) from within your web page code even though you can use the url manually in a browser to get the json data (as it seems you have done in your post). There are various security aspects and Google will not even send the data requested that way (I believe it is call cross-site-scripting - Google it for more details). It has to go - as in the example linked above, from you web page to your server, have the server do the request to Google to get the data, have the server then post this back to your site/ web page (through AJAX or just a new page - however you are doing things on your site). That's the sloppy and non-technical, but I wasted all day Sunday trying to get around this until I understood the issue and what I was supposed to (and had to do). This might not be what you are referring to but I think it may indeed be. If so I hope it helps. Cheers

Glenn
  • 26
  • 3