¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Trouble with Newtonsoft


 

Having a problem using newtonsoft to parse some very simple json.? The json is as follows:

JSON = {"acState": {"timestamp": {"time": "2021-06-16T02:43:50.929326Z", "secondsAgo": 0}, "on": true, "mode": "fan", "fanLevel": "low", "light": "on"}}

In my S# I have the following class

??? public class acState
??? {
??? ??? public bool on { get; set; }
??? ??? public string fanLevel{ get; set; }
??? ??? public string light{ get; set; }
??? ??? //mode and the timestamp are omitted because I don't care about their values
??? }

I'm parsing with the following.

??? ??? ??? ??? acState Data = JsonConvert.DeserializeObject<acState>(JSON);

However when I do some CrestronConsole.PrintLine statements to view the elements of the class the bool on is set to false and the other elements are empty.? No error is being thrown.

I know it has to be something basic that I'm just having trouble seeing.? Any ideas would be greatly appreciated.

Thanks in advance for the help

Jay

Join [email protected] to automatically receive all group messages.