Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 730543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:55:27+00:00 2026-05-14T06:55:27+00:00

I have a JSON response that is formatted from my C# WebMethod using the

  • 0

I have a JSON response that is formatted from my C# WebMethod using the JavascriptSerializer Class. I currently get the following JSON back from my query:

{"d":"[{\"Lat\":\"51.85036\",\"Long\":\"-8.48901\"},{\"Lat\":\"51.89857\",\"Long\":\"-8.47229\"}]"}

I’m having an issue with my code below that I’m hoping someone might be able to shed some light on. I can’t seem to get at the information out of the values returned to me. Ideally I would like to be able to read in the Lat and Long values for each row returned to me.

Below is what I currently have:

$.ajax({
                    type: "POST",
                    url: "page.aspx/LoadWayPoints",
                    data: "{'args': '" + $('numJourneys').val() + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (msg) {
                        if (msg.d != '[]') {
                            var lat = "";
                            var long = "";
                            $.each(msg.d, function () {
                                lat = this['Lat'];
                                long = this['Long'];
                            });
                            alert('lat =' + lat + ', long =' + long);
                        }
                    }
                });

I think the issue is something to do with how the JSON is formatted but I might be incorrect. Any help would be great.

Thanks,
Rich

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:55:28+00:00Added an answer on May 14, 2026 at 6:55 am

    What’s happening is you’re getting JSON encoded inside a string within your JSON. It’s redundant, but there is a solution without changing your output method.

    To handle this, jQuery has a JSON parser ($.parseJSON()) you can use do parse the string inside the response.

    So I believe you would do it like this:

    $.ajax({
      type: "POST",
      url: "page.aspx/LoadWayPoints",
      data: "{'args': '" + $('numJourneys').val() + "'}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        if (msg.d != '[]') {
          var content = $.parseJSON(msg.d);
    
          var lat = "";
          var long = "";
          $.each(content, function() {
            lat = this['Lat'];
            long = this['Long'];
          });
          alert('lat =' + lat + ', long =' + long);
        }
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a UITableViewController that parses a JSON response (using TouchJSON) fired asynchronously
I have a JSON response from a web service that I need to be
I have validated the JSON response from my C# Webmethod, so I don't believe
I have a ListBox that gets populated with items read from a JSON response.
I have an array of 'tasks' that I am getting back from a JSON
I have Json response from my database . I am using Php for this
I have a JSON multi-level response that I need to deserialize and from the
i have the following JSON response from google maps. I've given two postcodes as
If I have the following function that iterates through a json response object (val2):
Basically, I have a JSON response from the Twitter API containing a timeline. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.