I have the following JSON that is received in my webAPI endpoint.
{"time":1507739203,"messages":{"closedChat":[{"id":1280091,"channel":"widget","closed_at":"2017-10-11 13:26:43","tabulation":false}]},"token":"5df3c296972ffa6972"}
I am able to get the "time" variable in my controller but I'm not able to get the "closedChat" collection, always returns null.
here is my controller:
[AllowAnonymous]
[Route("api/test1/closedChat")]
[HttpPost]
public string closedChat([FromBody] rag msg)
{
string messageTime = msg.time; //this works
List<Fimmsg> teste2 = msg.messages; //this do not
return messageTime;
}
here is my rag class created to receive the JSON return:
public class rag
{
[JsonProperty("time")]
public string time { get; set; } //this works
[JsonProperty("messages")]
public List<Fimmsg> messages { get; set; } //this do not
}
and I created a Fimmsg class to hold the "messages" array/List:
public class Fimmsg
{
public int id { get; set; }
public string channel { get; set; }
public string closed { get; set; }
public string tabulation { get; set; }
}
What Am I missing to get the 'closedchat' collection?