Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to receive JSON array?

ASalihovASalihov Posts: 1Member
Help me, please with receiving some JSON array

If i sent request(by Fiddler) with Request Body like this:

[{"name":"Homerius", "tonumber":"155555", "fromnumber":"166666", "text":"&&??!"}, {"name":"Stone", "tonumber":"9654999", "fromnumber":"999666", "text":"h9miii99!"}]

how can I receive it in controller?

I try to do something like this:

[code]public HttpResponseMessage Post(JObject[] smspackage)
{
List smses = smspackage.ToList();
try
{
SMS_Repository.Add(smses);
return Request.CreateResponse(HttpStatusCode.Created, smses);
}
catch (Exception)
{

return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, "error");
}
}[/code]
but it dont works...

sorry for my bad english
Sign In or Register to comment.