I have the following javascript:
{
"presenceDetected":true,
"timestamp":1571219073514,
"RegionMap":{
"0":1,
"1":0
},
"deviceId":" TEST_DEVICE_ID "
}
and my current C# MVC class:
[DataContract]
public class Presence
{
[DataMember]
public bool presenceDetected { get; set; }
[DataMember]
public long timestamp { get; set; }
[DataMember]
public Array RegionMap { get; set; }
[DataMember]
public string deviceId { get; set; }
}
And my API method:
public void MonitorPresence([FromBody] Presence APresenceData)
{
//Loop thru RegionMap here.
}
While this seems to bring in the array - I don't actually get any values. I am sure its wrong. There might be 0, 1, or 2+ values within the region map array.
I am not able to change the JSON - how do I build my class to accept the RegionMap array?
RegionMapis not an array it is an object in your json.