0

I'm getting a JSON object(i.e. NewDataSet) in the POST request, see image below (Firebug-request object)...

enter image description here

How can i get this object at server side ??

Thanks Xtremist

1

2 Answers 2

3

I would create a server side object matching the JSON object you are posting to the server.

public class DataPackage
{
    public string CostType {get; set;}
    public string CostName {get; set;}
    public bool isEditable {get; set;}
    ...
}

In your webservice you can setup the service definition like this:

[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json, XmlSerializeString = false)]
public void MyWebservice(DataPackage NewDataSet) {
    ...
}

You need to tell your client side posting script that you are sending json:

contentType: 'application/json'

If I remember correctly this will tell ASP.NET to deserialize your JSON object into the .NET class.

Sign up to request clarification or add additional context in comments.

Comments

0

Checkout information on JSON.net

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.