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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:06:48+00:00 2026-05-26T11:06:48+00:00

I have the following json object that is available in my .ashx handler (var

  • 0

I have the following json object that is available in my .ashx handler (var items=):

{"Coverages":{"PersonID":10,"DetCode":"","Reimbursement":"","Deductible":"","MaximumPerAnnum":"","MaximumPerVisit":"","MaximumPerVisits":"","SvcCode":""},"CoverageCombinedMaximums":{"PersonID":10,"DetCode":["AAAAA","BBBBB","CCCCC"],"MaximumPerAnnum":""}} 

public void ProcessRequest (HttpContext context) {
        bool isSuccessful = true;

        var items = context.Request.Params["items"];
        if (isSuccessful)
        {

            JavaScriptSerializer ser = new JavaScriptSerializer();
            AdditionalCoveragesPackage package = ser.Deserialize<AdditionalCoveragesPackage>(items);


        }
        else
        {
            SendErrorMessage(context);
            return;
        } 
    }

Here is the structure of the class I’m trying to deserialize:

public class AdditionalCoverage
{
    public int PersonID { get; set; }
    public string DetCode { get; set; }
    public decimal? Reimbursement { get; set; }
    public decimal? Deductible { get; set; }
    public decimal? MaximumPerAnnum { get; set; }
    public decimal? MaximumPerVisit { get; set; }
    public int? MaximumPerVisits { get; set; }
    public string SvcCode { get; set; }

    public AdditionalCoverage()
    {
    }
}

public class AdditionalCoverageCombinedMaximum
{
    public int PersonID { get; set; }
    public string SvcCode { get; set; }
    public decimal? MaximumPerAnnum { get; set; }
    public List<string> DetCode { get; set; }

    public AdditionalCoverageCombinedMaximum()
    {
    }
}

public class AdditionalCoveragesPackage
{
    public List<AdditionalCoverage> Coverages { get; set; }
    public List<AdditionalCoverageCombinedMaximum> CoverageCombinedMaximums { get; set; }

    public AdditionalCoveragesPackage()
    {
    }

    public AdditionalCoveragesPackage(AdditionalCoverage coverage, AdditionalCoverageCombinedMaximum maximum)
    {
        List<AdditionalCoverage> coverages = new List<AdditionalCoverage>();
        coverages.Add(coverage);
        Coverages = coverages;

        List<AdditionalCoverageCombinedMaximum> maximums = new List<AdditionalCoverageCombinedMaximum>();
        maximums.Add(maximum);
        CoverageCombinedMaximums = maximums;
    }

    public AdditionalCoveragesPackage(List<AdditionalCoverage> coverages, List<AdditionalCoverageCombinedMaximum> maximums)
    {
        Coverages = coverages;
        CoverageCombinedMaximums = maximums;
    }
}

Edit: Here are my client side methods that need correction:

function saveCoverageDetails() {
                var handler = "HttpHandlers/UpdateAdditionalCoverageDetailsHandler.ashx";
                var coverages = { PersonID: personId, DetCode: "", Reimbursement: "", Deductible: "", MaximumPerAnnum: "", MaximumPerVisit: "", MaximumPerVisits: "", SvcCode: "" };
                var maximums = { PersonID: personId, DetCode: ["ACUPUN", "PODIAT", "OSTEOP"], MaximumPerAnnum: "" };
                var obj = { Coverages: coverages, CoverageCombinedMaximums: maximums };


                var data = ({ items: JSON.stringify(obj) });
                callHandler(handler, data, saveSuccessful, failure);

            }
   function callHandler(handler, obj, onSuccess, onFail) {

                $.ajax({
                    type: "POST",
                    url: handler,
                    data: obj,
                    dataType: "json",
                    success: onSuccess,
                    fail: onFail

                });

            }

When I’m using the javascript serializer it does return my AdditionalCoveragesPackage object – however – both of the properties: Coverages and CombinedMaximums are empty. How to get this to properly deserialize my json string?

  • 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-26T11:06:48+00:00Added an answer on May 26, 2026 at 11:06 am

    In your JSON string Coverages and CoverageCombinedMaximums are simple objects, not arrays, so:

    public class AdditionalCoveragesPackage
    {
        public AdditionalCoverage Coverages { get; set; }
        public AdditionalCoverageCombinedMaximum CoverageCombinedMaximums { get; set; }
    }
    

    Also in your example JSON:

    "MaximumPerAnnum":""
    

    so make sure you define the corresponding property as a nullable decimal:

    public decimal? MaximumPerAnnum { get; set; }
    

    or the deserializer will blow.

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

Sidebar

Related Questions

I have an extremely simple JSON object that looks like the following: var data
I have the following JSON object that is passed to one of my functions
Let's suppose that we have the following JSON Object that describes a Person: {
I have parsed a json object that has the following structure: { data =
I have a json object that follows the following structure: $foo->bar['1']->#foobar The hash is
If I have the following function that iterates through a json response object (val2):
I have the following JSON object: { response: { status: 200 }, messages: [
say I have the following json object; {'fname':'john', 'lname':'Locke'} and the following text boxes
Example: I have the following JSON object. {currentVersion : 10.0, folders : [], services
If you have the following: Asp.Net MVC 2 project having object classes that define

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.