Well, for a start, that "JSON" is invalid. At a guess, it should look more like this:
{
"wifi_sta": {
"connected":true,
"mqtt":{"connected":false},
"actions_stats":{"skipped":0},
"relays":[
{
"ison":false,
"has_timer":false,
"is_valid":true
},
{
"ison":false,
"has_timer":false,
"is_valid":true
}
]
}
}
Once you have valid JSON, you can use Visual Studio's "paste JSON as classes" option to generate the classes you need to deserialize into.
Or you can use an online tool like
quicktype[
^] to generate the classes for you - although that one doesn't support VB.NET, but translating from C# shouldn't be too hard.
public class Root
{
[JsonPropertyName("wifi_sta")]
public WifiSta WifiSta { get; set; }
}
public partial class WifiSta
{
[JsonPropertyName("connected")]
public bool Connected { get; set; }
[JsonPropertyName("mqtt")]
public Mqtt Mqtt { get; set; }
[JsonPropertyName("actions_stats")]
public ActionsStats ActionsStats { get; set; }
[JsonPropertyName("relays")]
public Relay[] Relays { get; set; }
}
public partial class ActionsStats
{
[JsonPropertyName("skipped")]
public long Skipped { get; set; }
}
public partial class Mqtt
{
[JsonPropertyName("connected")]
public bool Connected { get; set; }
}
public partial class Relay
{
[JsonPropertyName("ison")]
public bool Ison { get; set; }
[JsonPropertyName("has_timer")]
public bool HasTimer { get; set; }
[JsonPropertyName("is_valid")]
public bool IsValid { get; set; }
}