5

Some serwer sends POST requests with the following information:

{
    payload: {
    uid: "900af657a65e",
    amount: 50,
    adjusted_amount: 25
},
 signature: "4dd0f5da77ecaf88628967bbd91d9506"
}

How shoud I successfully process that in my ASHX handler?

user2441297
  • 241
  • 2
  • 4
  • 13

1 Answers1

11

As SLaks noted, that's not valid JSON. But in general, a good solution for serializing/deserializing JSON in .NET is the JSON.NET library: http://json.codeplex.com/. There is plenty of documentation there that should get you started.

Edit: to read the request body, try something like

 string postData = new System.IO.StreamReader(context.Request.InputStream).ReadToEnd();
Ryan M
  • 2,072
  • 11
  • 14