rajesh n

rajesh n

  • NA
  • 62
  • 1.2k

Getting null if post Json Serializable object array

Apr 26 2017 8:53 AM

i am sending data using HttpClient like below

using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write(JsonConvert.SerializeObject(message).ToArray()); }
by using ToArray() entire message converted to character array
 

what would be the web api controller method parameter

i am going to use like below

public IHttpActionResult ReceivedMessages([FromBody] Queue<Message> messages)
 
I have tried char[] array and string[] array also. i am getting null value always. But if i checked this request.Content.ReadAsStringAsync().Result i am receiving the value in string format but in controller class i am getting null
 

Answers (2)