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 671255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:21:11+00:00 2026-05-14T00:21:11+00:00

I have an asp.net page which is returning a list of object as a

  • 0

I have an asp.net page which is returning a list of object as a json string to an ajax request. The string is as follows :

[
    {"Name":"Don","Age":23,"Description":"Tall man with no glasses"}
    ,{"Name":"Charlie","Age":24,"Description":"Short man with glasses"}
]

I want to access each field individually, like the name of the person, his age, his description etc.

How can I do that? I am using JQuery for client-side scripting.

For further clarification, here is the server-side C# code –

protected void Page_Load(object sender, EventArgs e)
{
    if (Request["field1"] != null)
    {            
        createPersonList();
    }
}

private void createPersonList()
{
    List<Person> PersonList = new List<Person>();

    Person Atiq = new Person("Atiq Hasan Mollah", 23, "Whassap Homie");
    Person Sajib = new Person("Sajib Mamud", 24, "Chol kheye ashi");

    PersonList.Add(Atiq);
    PersonList.Add(Sajib);

    string json = JsonConvert.SerializeObject(PersonList);

    Response.Clear();
    Response.Write(json);
    Response.End();
}

The client-side javascript code is as follows –

$(function()
{   
    $("#SimpleButton").click(function()
    {

        $.post("Default.aspx", {field1: $("#field1").val()},function(data)
        {
            data = $.trim(data);
            $("#field2").val(data);

            var myObject = eval('(' + data + ')');

            $(data).each(function(index, person)
            {
                alert(  'Name: ' + person.Name + 
                        ' Age: ' + person.Age + 
                        ' Description: ' + person.Description
                    );
            });
        });
    });
});

Now if I don’t use “eval” myself, then how can I pass the arraylist from server-side and then parse it using javascript ?

  • 1 1 Answer
  • 1 View
  • 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-14T00:21:12+00:00Added an answer on May 14, 2026 at 12:21 am

    You can ask jQuery to parse the JSON automatically and return a JavaScript object rather than a string:

    var people = $.getJSON('http://example.com/path/to/page');
    

    If you want to use POST rather than GET, you can provide a data type as the fourth parameter:

    $.post("Default.aspx", {field1: $("#field1").val()}, function(data) { ... }, "json");
    

    You can then access it just as you would a normal object:

    $.each(people, function(function (i, person) {
        $('#people').append($('<p>').text(person.Name));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.Net page, which displays a list of options to the user.
I have a WCF service in an ASP.NET AJAX app that is returning json.
I have an asp.net page which launches a child page in another browser window
I have an asp.net / C# page which takes a comment, and then emails
I have an ASP.NET 3.5 page which has multiple span elements with ID containing
I have a asp.net webforms page in which I'm using the jqGrid component. The
I have an ASP.Net web page, which uses a Master Page template. The page
I have a ASP.NET MVC page, which call WCF logic. The system is single-signon
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
In my ASP.NET MVC app, I have a fairly complex edit page which combines

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.