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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:49:22+00:00 2026-06-10T20:49:22+00:00

I am trying to post data in JSON format to a .NET MVC Controller

  • 0

I am trying to post data in JSON format to a .NET MVC Controller like this.

$.ajax({
         type: 'POST',
         url: 'http://mvc.tester.local/Home/NameConverter',
         data: JSON.stringify({ convertermodel.InputName: obj.currentTarget.value }),
         contentType: 'application/json'
});

But Javascript complains about the JSON.Stringify() bit.
The convertermodel.InputName to be exact.

The thing is I actually need this JSON data name to be that way i.e. have the same name as a property in my model; in order to take advantage of reflection for automatic binding.

This is my model:

public class NamesViewModel
{
    public NameConverterModel convertermodel = new NameConverterModel();        
}

and the sub Class

public class NameConverterModel
{
    private string _inputName = "";
    public string InputName
    {
        get { return _inputName; }
        set { _inputName = value; }
    }    
}

How can I solve this please ?

I hope I am clear enough.

  • 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-10T20:49:24+00:00Added an answer on June 10, 2026 at 8:49 pm

    You would need your JSON to be of the structure like this:

    {"convertermodel" : {
                          "InputName" : obj.currentTarget.value
                        }
    }
    

    Your JSON representation of your object needs to reflect the appropriate nesting that your object model that you’re trying to model in the client-side requires. So defining your JSON by nesting your hierarchy at one level won’t work — you need to create objects of objects like you did in your C# code.

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

Sidebar

Related Questions

Trying to post JSON data to Spring controller.. Not working at all JSP Code:
I'm trying to use jquery.Ajax to post data to an ASP.NET MVC2 action method
I noticed when trying to post form data in JSON format, that the following
I am trying to send data, in json format to my webservice, using POST.
I am trying to post some data with jQuery Ajax, but the parameters in
After trying to format my JSON data by hand in javascript and failing miserably,
Sorry for poor english :) I was trying to post form in json format
I'm trying to send some data via JQuery ajax to a grails controller Here's
I am trying to send data in a JSON format to my django app.
I'm trying to POST some JSON data using Adobe Flex but having some problems.

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.