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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:13:27+00:00 2026-05-27T11:13:27+00:00

How can I serializes the following as a json result? The object is coming

  • 0

How can I serializes the following as a json result? The object is coming back to my controller as null.

public class CertRollupViewModel
{
    public IEnumerable<CertRollup> CertRollups { get; set; }
}

public class CertRollup
{
    public decimal TotalCpm { get; set; }
    public decimal TotalIO { get; set; }
}

// The json obj leaves the controller method "GetAlerts" ok but not sure how to validate if the object
//   is intact before it get's passed into the GetCertRollupView.
//   The GetCertRollupView is where the json object is null

// Some button click...
$.get('@Url.Action("GetCerts")',   **// STEP 1**
    function (data) {
     $("#rollupgridview").load('@Url.Action("GetCertRollUpView")',  **// STEP 3**
        data);
...

public ActionResult GetCerts()  **// STEP 2**
{
    ...
    return Json(CertRollupViewModelObject, JsonRequestBehavior.AllowGet);
}

public ActionResult GetCertRollUpView(CertRollupViewModel certRollupViewModel)  **// STEP 4**
{
  // certRollupViewModel IS NULL!!!
 return PartialView("_CertRollUp", certRollupViewModel);
}

NOTE: The structure does get passed in correctly however, the values for CertRollup are 0’s.

Immediate window per Visual Studio:

?certRollupViewModel.CertRollups 
     Count = 1
    [0]: {Models.CertRollup} ?CertRollupViewModel.CertRollups.First() {Models.CertRollup}
    TotalCpm: 0
  • 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-27T11:13:27+00:00Added an answer on May 27, 2026 at 11:13 am

    Try this:

    function loadRollupGridView () {
        $.ajax({
            url: '@Url.Action("GetCerts")',
            type: 'GET',
            success: function(certRollupViewModel) { 
                $('#rollupgridview')
                    .load('@Url.Action("GetCertRollupView"), certRollupViewModel)');
            },               
            error: function () {
                $('#rollupgridview')
                    .html('<div class="error">Something went wrong...</div>');
            }
        });
    }
    

    I think the main issue is that you are passing the variable data to the Controller, not certRollupViewModel like it is expecting.

    This is what your JSON object should look like when being passed to the controller:

    {"certRollupViewModel": 
      {"CertRollups":
        [
          {"TotalCpm": "25.35", "TotalIO": "380.23"}, 
          {"TotalCpm": "25.35", "TotalIO": "380.23"},
          {"TotalCpm": "25.35", "TotalIO": "380.23"}
        ]
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am serializing and deserializing following domain object to JSON using Jackson 1.8.3 public
What C-sharp type can I serialize to get JSON object with format name:[[1,2,3],[1,2,3],[1,2,3]] If
I have the following C# helper class which retrieves a Json String from a
consider the following class and struct public class Entity { public IdType Id {get;set;}
I've got following classes: public class Container { private String name; private Data data;
How can I de-serialize a json object sent from javascript (using jquery.ajax) to a
In the following Jackson/Java code that serializes objects into JSON, I am getting this:
I am serializing a class like this into JSON using Flexjson: public class Item
In MVC I can do something like the following to serialise an object with
I am looking for a tool that can serialize and/or transform SQL Result Sets

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.