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

  • Home
  • SEARCH
  • 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 8002651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:25:43+00:00 2026-06-04T16:25:43+00:00

Two related ASP.NET Web Service JSON questions here. I’m using a N-tier designed ASP.NET

  • 0

Two related ASP.NET Web Service JSON questions here. I’m using a N-tier designed ASP.NET 2.0 application.


Question 1:
I am trying to get my ASP.NET web service to generate a multiple object JSON response where each object has multiple objects returned. I’m not sure if I am explaining that properly, so here is an example of what I am looking for.

[
    {"id":1, "CommentDataElement": "Value",
        "OldData":{ "Description": "ABC", "Status": "0" },
        "NewData":{ "ShortText": "Text here", "LongText": "More text here" }
    },
    {"id":2, "CommentDataElement": "Value",
        "OldData":{ "Description": "DEF", "Status": "1" },
        "NewData":{ "ShortText": "Text here", "LongText": "More text here" }
    },
    {"id":3, "CommentDataElement": "Value",
        "OldData":{ "Description": "GHI", "Status": "2" }
    },
    {"id":4, "CommentDataElement": "Value",
        "NewData":{ "ShortText": "Text here", "LongText": "More text here" }
    }
]

id‘s 1 and 2 have both Old and New datasets, while id 3 only has an Old dataset and id 4 only has a New dataset.

I would then use jQuery to handle this response. And based on the existence of the Old and New datasets, I would generate the proper page elements.

The source of the OldData and NewData are in two different tables. So is this possible to do?


Question 2:
In addition, is it possible to have an ASP.NET web service return a JSON string with two different object structures? Example.

[
    {...same as above, just cut out for brevity...}
    {"id":4, "CommentDataElement": "Value",
        "NewData":{ "ShortText": "Text here", "LongText": "More text here" }
    },
    {"Count":"100"}
]

Basically what I want to do, is make one request to the server, get my truncated dataset (based on paging, say only returning 20 records of the full set) and get the full record set count so that I can generate my page numbers (pagination). On my Data Access Layer, is it possible to use a return statement for the record set and an OUTPUT parameter for the full count? Just a thought.


I’m pretty sure that the JSON that I have written here is not proper. Please feel free to updated as you see fit. Any help is appreciated! Thanks!

  • 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-06-04T16:25:46+00:00Added an answer on June 4, 2026 at 4:25 pm

    I was able to resolve this issue.

    Basically you create the class, then create the class as a list. For example…

    public class OldData
    {
        private string _Description = string.empty;
        private string _Status = string.empty;
    
        public string Description { get {return _Description;} set {_Description = value; } }
        public string Status { get {return _Status;} set {_Status = value; } }
    }
    
    public class NewData
    {
        private string _ShortText = string.empty;
        private string _LongText = string.empty;
    
        public string ShortText { get {return _ShortText;} set {_ShortText = value; } }
        public string LongText { get {return _LongText;} set {_LongText = value; } }
    }
    
    public class Results
    {
        private int? _ID = null;
        private OldData _od = null;
        private NewData _nd = null;
    
        public int? ID { get {return _ID;} set {_ID = value; } }
        public OldData od { get {return _od;} set {_od = value; } }
        public NewData nd { get {return _nd;} set {_nd = value; } }
    }
    
    public class Results_List : List<Results>
    {
        public Results_List() { }
    }
    

    You then can create an instance of the class and populate it with data from your database. The JSON response is then in the proper format for the client side logic. Hopefully this helps someone else. Enjoy!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in asp.net MVC2 application and I have question related to design
In my web application (asp.net & vb code), I had two different gridview. Each
I've got two different, but closely related ASP.Net web applications that use the same
In VS 2010 the ASP.Net Web Application template creates a master page with two
I have two questions related to the performance of Dozer using its Java API:
I have two ASP.NET websites on a web-server, and two SQL Server databases. I
ASP.NET 3.5 C# I am joining two tables using Linq. Table names are MapAssets
I am working on an asp.net application. I need help designing the database related
I work on a web-application that is written in C#/ASP.NET. The original framers of
Two UITableViewCell related questions: In my custom UITableViewCell I loop through an array (of

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.