我如何检索此的Lat和Long值?

时间:2014-01-07 02:44:23

标签: javascript dictionary parse-platform

我正在开发iOS应用程序,但我正在使用parse.com SDK。他们有一些叫做云代码的东西我试图使用,但它在JS中,我一无所知。我需要每个事件的lat和long值,但响应是字符串而不是字典。

Parse.Cloud.define("findEvents", function(request, response) {

                   var url = ("movie", request.params.movie);

                   Parse.Cloud.httpRequest({
                                           url: url,
                                           success: function(httpResponse) {
                                                console.log(httpResponse.text);

                                           var s = httpResponse.text;


                                                response.success(s);
                                           },
                                           error: function(httpResponse) {
                                                console.error('Request failed with response code ' + httpResponse.status);
                                                response.error(httpResponse.text);
                                           }
                    });
});

这是回复

{
events =     {
    event =         (
                    {
            "all_day" = 0;
            "calendar_count" = "<null>";
            calendars = "<null>";
            "city_name" = "Daytona Beach";
            "comment_count" = "<null>";
            "country_abbr" = USA;
            "country_abbr2" = US;
            "country_name" = "United States";
            created = "2013-10-09 07:16:07";
            description = "<null>";
            "geocode_type" = "EVDB Geocoder";
            going = "<null>";
            "going_count" = "<null>";
            groups = "<null>";
            id = "E0-001-062216029-9";
            image =                 {
                caption = "<null>";
                height = 48;
                medium =                     {
                    height = 128;
                    url = "http://s4.evcdn.com/images/medium/I0-001/003/062/707-0.jpeg_/gregg-allman-07.jpeg";
                    width = 128;
                };
                small =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/small/I0-001/003/062/707-0.jpeg_/gregg-allman-07.jpeg";
                    width = 48;
                };
                thumb =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/thumb/I0-001/003/062/707-0.jpeg_/gregg-allman-07.jpeg";
                    width = 48;
                };
                url = "http://s4.evcdn.com/images/small/I0-001/003/062/707-0.jpeg_/gregg-allman-07.jpeg";
                width = 48;
            };
            latitude = "29.2269980";
            "link_count" = "<null>";
            longitude = "-81.0105420";
            modified = "2013-12-17 10:47:43";
            owner = evdb;
            performers =                 {
                performer =                     {
                    creator = chuck;
                    id = "P0-001-000009039-4";
                    linker = evdb;
                    name = "Gregg Allman";
                    "short_bio" = Music;
                    url = "http://eventful.com/performers/gregg-allman-/P0-001-000009039-4?utm_source=apis&utm_medium=apim&utm_campaign=apic";
                };
            };
            "postal_code" = 32115;
            privacy = 1;
            "recur_string" = "<null>";
            "region_abbr" = FL;
            "region_name" = Florida;
            "start_time" = "2014-01-03 19:30:00";
            "stop_time" = "<null>";
            title = "Gregg Allman";
            "tz_city" = "<null>";
            "tz_country" = "<null>";
            "tz_id" = "<null>";
            "tz_olson_path" = "<null>";
            url = "http://eventful.com/daytonabeach/events/gregg-allman-/E0-001-062216029-9?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "venue_address" = "600 Auditorium Boulevard";
            "venue_display" = 1;
            "venue_id" = "V0-001-001187040-4";
            "venue_name" = "Peabody Auditorium";
            "venue_url" = "http://eventful.com/daytonabeach/venues/peabody-auditorium-/V0-001-001187040-4?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "watching_count" = "<null>";
        },
                    {
            "all_day" = 0;
            "calendar_count" = "<null>";
            calendars = "<null>";
            "city_name" = Sanford;
            "comment_count" = "<null>";
            "country_abbr" = USA;
            "country_abbr2" = US;
            "country_name" = "United States";
            created = "2011-02-24 08:57:26";
            description = "An open mic of any talent you may have. Rant, poetry, singing, playing, dancing, and any other thing you deem worthy!";
            "geocode_type" = "EVDB Geocoder";
            going = "<null>";
            "going_count" = "<null>";
            groups = "<null>";
            id = "E0-001-037213297-1@2014010219";
            image =                 {
                caption = "<null>";
                height = 48;
                medium =                     {
                    height = 128;
                    url = "http://s4.evcdn.com/images/medium/I0-001/003/876/551-6.jpeg_/open-mic-51.jpeg";
                    width = 128;
                };
                small =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/small/I0-001/003/876/551-6.jpeg_/open-mic-51.jpeg";
                    width = 48;
                };
                thumb =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/thumb/I0-001/003/876/551-6.jpeg_/open-mic-51.jpeg";
                    width = 48;
                };
                url = "http://s4.evcdn.com/images/small/I0-001/003/876/551-6.jpeg_/open-mic-51.jpeg";
                width = 48;
            };
            latitude = "28.8117215";
            "link_count" = "<null>";
            longitude = "-81.2657533";
            modified = "2013-03-15 09:32:12";
            owner = moire;
            performers = "<null>";
            "postal_code" = "<null>";
            privacy = 1;
            "recur_string" = "weekly on Thursdays until February 24, 2014";
            "region_abbr" = FL;
            "region_name" = Florida;
            "start_time" = "2014-01-02 19:30:00";
            "stop_time" = "2014-01-03 00:00:00";
            title = "Open Mic";
            "tz_city" = "<null>";
            "tz_country" = "<null>";
            "tz_id" = "<null>";
            "tz_olson_path" = "<null>";
            url = "http://orlando.eventful.com/events/open-mic-/E0-001-037213297-1@2014010219?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "venue_address" = "309 E First Street";
            "venue_display" = 1;
            "venue_id" = "V0-001-001317154-7";
            "venue_name" = "Little Fish Huge Pond";
            "venue_url" = "http://orlando.eventful.com/venues/little-fish-huge-pond-/V0-001-001317154-7?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "watching_count" = "<null>";
        },
                    {
            "all_day" = 0;
            "calendar_count" = "<null>";
            calendars = "<null>";
            "city_name" = "Saint Augustine";
            "comment_count" = "<null>";

            "country_abbr" = USA;
            "country_abbr2" = US;
            "country_name" = "United States";
            created = "2011-01-10 06:20:53";
            description = "The Old City Scrabblers host bi-weekly Scrabble games in a fun and non-competitive atmosphere. We play regular and Super Scrabble but primarily offer Super Scrabble games. Boards and dictionaries are provided. We&#39;re open to all levels of players from beginners through experienced. We play by standard Scrabble rules.";
            "geocode_type" = "EVDB Geocoder";
            going = "<null>";
            "going_count" = "<null>";
            groups = "<null>";
            id = "E0-001-036239869-3@2014010513";
            image =                 {
                caption = "<null>";
                height = 48;
                medium =                     {
                    height = 128;
                    url = "http://s4.evcdn.com/images/medium/I0-001/003/771/307-5.jpeg_/old-city-scrabblers-scrabble-game-07.jpeg";
                    width = 128;
                };
                small =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/small/I0-001/003/771/307-5.jpeg_/old-city-scrabblers-scrabble-game-07.jpeg";
                    width = 48;
                };
                thumb =                     {
                    height = 48;
                    url = "http://s4.evcdn.com/images/thumb/I0-001/003/771/307-5.jpeg_/old-city-scrabblers-scrabble-game-07.jpeg";
                    width = 48;
                };
                url = "http://s4.evcdn.com/images/small/I0-001/003/771/307-5.jpeg_/old-city-scrabblers-scrabble-game-07.jpeg";
                width = 48;
            };
            latitude = "29.8591883";
            "link_count" = "<null>";
            longitude = "-81.2815189";
            modified = "2013-03-15 09:18:46";
            owner = OCScrabblers;
            performers = "<null>";
            "postal_code" = 32080;
            privacy = 1;
            "recur_string" = "weekly on Sundays until January 16, 2014";
            "region_abbr" = FL;
            "region_name" = Florida;
            "start_time" = "2014-01-05 13:00:00";
            "stop_time" = "2014-01-05 17:00:00";
            title = "Old City Scrabblers - Scrabble game";
            "tz_city" = "<null>";
            "tz_country" = "<null>";
            "tz_id" = "<null>";
            "tz_olson_path" = "<null>";
            url = "http://eventful.com/staugustine/events/old-city-scrabblers-scr-/E0-001-036239869-3@2014010513?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "venue_address" = "500 Pope Rd";
            "venue_display" = 1;
            "venue_id" = "V0-001-004785279-9";
            "venue_name" = "St Augustine YMCA";
            "venue_url" = "http://eventful.com/staugustine/venues/st-augustine-ymca-/V0-001-004785279-9?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "watching_count" = "<null>";
        },
                    {
            "all_day" = 0;
            "calendar_count" = "<null>";
            calendars = "<null>";
            "city_name" = "Saint Augustine";
            "comment_count" = "<null>";
            "country_abbr" = USA;
            "country_abbr2" = US;
            "country_name" = "United States";
            created = "2011-01-10 06:15:30";
            description = "Old City Scrabblers offers free Scrabble games in a non-competitive and fun atmosphere. We are open to players of all ages and levels of play - including beginners. We play regular and Super Scrabble games, but primarily Super Scrabble. Boards and dictionaries are provided. Just come and have fun!";
            "geocode_type" = "EVDB Geocoder";
            going = "<null>";
            "going_count" = "<null>";
            groups = "<null>";
            id = "E0-001-036239863-9@2014010113";
            image =                 {
                caption = "<null>";
                height = 48;
                medium =                     {
                    height = 128;
                    url = "http://s3.evcdn.com/images/medium/I0-001/003/771/302-0.jpeg_/old-city-scrabblers-scrabble-game-02.jpeg";
                    width = 128;
                };
                small =                     {
                    height = 48;
                    url = "http://s3.evcdn.com/images/small/I0-001/003/771/302-0.jpeg_/old-city-scrabblers-scrabble-game-02.jpeg";
                    width = 48;
                };
                thumb =                     {
                    height = 48;
                    url = "http://s3.evcdn.com/images/thumb/I0-001/003/771/302-0.jpeg_/old-city-scrabblers-scrabble-game-02.jpeg";
                    width = 48;
                };
                url = "http://s3.evcdn.com/images/small/I0-001/003/771/302-0.jpeg_/old-city-scrabblers-scrabble-game-02.jpeg";
                width = 48;
            };
            latitude = "29.8591883";
            "link_count" = "<null>";
            longitude = "-81.2815189";
            modified = "2013-03-15 09:21:57";
            owner = OCScrabblers;
            performers = "<null>";
            "postal_code" = 32080;
            privacy = 1;
            "recur_string" = "weekly on Wednesdays until January 12, 2014";
            "region_abbr" = FL;
            "region_name" = Florida;
            "start_time" = "2014-01-01 13:30:00";
            "stop_time" = "2014-01-01 17:00:00";
            title = "Old City Scrabblers - Scrabble game";
            "tz_city" = "<null>";
            "tz_country" = "<null>";
            "tz_id" = "<null>";
            "tz_olson_path" = "<null>";
            url = "http://eventful.com/staugustine/events/old-city-scrabblers-scr-/E0-001-036239863-9@2014010113?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "venue_address" = "500 Pope Rd";
            "venue_display" = 1;
            "venue_id" = "V0-001-004785279-9";
            "venue_name" = "St Augustine YMCA";
            "venue_url" = "http://eventful.com/staugustine/venues/st-augustine-ymca-/V0-001-004785279-9?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "watching_count" = "<null>";
        },
                    {
            "all_day" = 0;
            "calendar_count" = "<null>";
            calendars = "<null>";
            "city_name" = Sanford;
            "comment_count" = "<null>";
            "country_abbr" = USA;
            "country_abbr2" = US;
            "country_name" = "United States";
            created = "2011-03-07 09:43:22";
            description = "This is an evening for writers, playwrights, comedians and actors to work on their craft. Bring your work for discussion, cold reading or performance. It&#39;s a workshop.";
            "geocode_type" = "EVDB Geocoder";
            going = "<null>";
            "going_count" = "<null>";
            groups = "<null>";
            id = "E0-001-037399917-9@2014010620";
            image =                 {
                caption = "<null>";
                height = 48;
                medium =                     {
                    height = 128;
                    url = "http://s2.evcdn.com/images/medium/I0-001/003/897/477-0.gif_/those-my-words-77.gif";
                    width = 128;
                };
                small =                     {
                    height = 48;
                    url = "http://s2.evcdn.com/images/small/I0-001/003/897/477-0.gif_/those-my-words-77.gif";
                    width = 48;
                };
                thumb =                     {
                    height = 48;
                    url = "http://s2.evcdn.com/images/thumb/I0-001/003/897/477-0.gif_/those-my-words-77.gif";
                    width = 48;
                };
                url = "http://s2.evcdn.com/images/small/I0-001/003/897/477-0.gif_/those-my-words-77.gif";
                width = 48;
            };
            latitude = "28.8117215";
            "link_count" = "<null>";
            longitude = "-81.2657533";
            modified = "2013-03-15 09:32:03";
            owner = moire;
            performers = "<null>";
            "postal_code" = "<null>";
            privacy = 1;
            "recur_string" = "weekly on Mondays until March 7, 2014";
            "region_abbr" = FL;
            "region_name" = Florida;
            "start_time" = "2014-01-06 20:00:00";
            "stop_time" = "2014-01-06 22:00:00";
            title = "Those Are My Words";
            "tz_city" = "<null>";
            "tz_country" = "<null>";
            "tz_id" = "<null>";
            "tz_olson_path" = "<null>";
            url = "http://orlando.eventful.com/events/those-my-words-/E0-001-037399917-9@2014010620?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "venue_address" = "309 E First Street";
            "venue_display" = 1;
            "venue_id" = "V0-001-001317154-7";
            "venue_name" = "Little Fish Huge Pond";
            "venue_url" = "http://orlando.eventful.com/venues/little-fish-huge-pond-/V0-001-001317154-7?utm_source=apis&utm_medium=apim&utm_campaign=apic";
            "watching_count" = "<null>";
        },

1 个答案:

答案 0 :(得分:0)

您可以将JSON字符串解析为Object

尝试使用此版本的成功回调。它应该引导您走向解决方案。

success: function(httpResponse) {
         var responseObj = JSON.parse(httpResponse.text);
         console.log(responseObj);
         var s = httpResponse.text;
         response.success(s);
},