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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:43:21+00:00 2026-05-24T05:43:21+00:00

How do I map JSON object to C# object ? var Data = JSON.stringify({

  • 0

How do I map JSON object to C# object ?

  var Data = JSON.stringify({
                    FirstName: "sdfsdf",
                    LastName: "sdfsdf", Age: "sdfsdf", Descrp: "sdfsdf"
                });

for example converting Data to C# class with same properties.
I tried this :

 var Data = JSON.stringify({
                FirstName: "sdfsdf",
                LastName: "sdfsdf", Age: "sdfsdf", Descrp: "sdfsdf"
            });
            $.ajax({
                type: "POST",
                url: "Services/CRUD.asmx/CreatePerson",
                data: Data,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    alert(msg.d);

                }
            });

but when I checked with firebug this error returned :

{"Message":"Invalid web service call, missing value for parameter: \u0027PersonObj\u0027.","StackTrace":"   at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n   at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
  • 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-24T05:43:24+00:00Added an answer on May 24, 2026 at 5:43 am

    You can definitely do that, but you need to make sure the client-side object matches your server-side class structure, property names, and parameter name exactly.

    It sounds like your server-side method is expecting a PersonObj parameter, but you aren’t structuring it that way on the client-side. Try something like this:

    var Data = JSON.stringify({ 
      PersonObj: {
        FirstName: 'foo',
        LastName: 'bar',
        Age: 99,
        Descrp: 'foo person'
      }
    });   
    

    I’ve written about doing this in-depth here: http://encosia.com/using-complex-types-to-make-calling-services-less-complex/

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

Sidebar

Related Questions

I need to get the JSON object data out of the callback function so
code //array store the markers var googleMarker = []; //this function get json object
Hello I'm looping over a JSON object and creating a new map marker for
I made a servlet which creates a Map Object: Map<String, Integer> data = new
I want to get data from thisarray of json object : [ { outgoing_relationships:
What's the best way to return a Java Map using the JSON format? My
I am building a Railo app which deals with a lot of JSON data
Possible Duplicate: How do I test for an empty Javascript object from JSON? Is
For deserializing json with unknown field into an object there's @JsonAnySetter. But what if
I have some JSON objects I'd like to store in a map for the

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.