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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:31:20+00:00 2026-05-23T20:31:20+00:00

I reached a road bump while trying to use some of the cool new

  • 0

I reached a road bump while trying to use some of the cool new feature of MVC 3.

Is it possible to overload controllers using custom JSON binding using MVC3 ?

It doesnt look like it works automatically as of now….
What’s the neatest way to do this ?
For example
If I want to implement the following endpoint

[HttpPost]
public ActionResult GetPet(Cat catObject)
{
return Json(catObject.purr());
}

overloaded with this endpoint

[HttpPost]
public ActionResult GetPet(Dog dogObject)
{
return Json(dog.bark());
}

Is there any way i can do this without using thirdparty libraries Or System.Web.Script.Serialization.JavaScriptSerializer

Also Is there any particular reason this is not implemented in mvc3 yet?

  • 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-23T20:31:21+00:00Added an answer on May 23, 2026 at 8:31 pm

    Overloading Json objects on controllers seems a distant possibility now rather than a present reality.
    This is the closest I could get to overloading the action

    [HttpPost]
    public ActionResult GetPet()
    {
    Cat catObj;
    Dog dogObg;
    if (TryUpdateModel(catObj))
            return Json(catObj.purr());
    else
    {
        ModelState.Clear();
        if (TryUpdateModel(dogObg))
            return Json(dogObj.bark());
        else
        {
            ModelState.Clear();
            ModelState.AddModelError("InvalidInput", "The given input does not match with any of the accepted JSON types");
            return new HttpBadRequestResult(ModelState);
        }
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with some complex queries using the dynamic find_all method and reached
Possible Duplicate: UIPopovercontroller dealloc reached while popover is still visible Im creating a universal
I am trying to store a phone number and I have reached some problems
I've been trying different ways for a while and I've reached that point where
Is it possible to execute code when a specific time is reached on an
I've recently reached the stage where an ASP.net MVC application I am developing is
We've reached the end of our tether here trying to overcome a nasty and
I have a file that can be reached using multiple paths: http://mydomain.com/portal1/movie.swf http://mydomain.com/portal2/movie.swf http://mydomain.com/portal1/substep/movie.swf
I'm reading through Learn You a Haskell and reached a spot where I'm trying
I've reached my skills limit here. I don't even know if this is possible

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.