2
Answers

Getting null if post Json Serializable object array

rajesh n

rajesh n

7y
243
1

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)