using System.Collections.Generic;
public static void Main()
""access_token"": ""c.FmDPkzyzaQe..."",
""peyiJNo0IldT2YlIVtYaGQ"": {
""device_id"": ""peyiJNo0IldT2YlIVtYaGQ"",
""software_version"": ""4.0"",
""structure_id"": ""VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3-BOLY0BA4sw"",
""name"": ""Hallway (upstairs)"",
""name_long"": ""Hallway Thermostat (upstairs)"",
""last_connection"": ""2014-10-31T23:59:59.000Z"",
""is_using_emergency_heat"": true,
""fan_timer_active"": true,
""fan_timer_timeout"": ""2014-10-31T23:59:59.000Z"",
""temperature_scale"": ""C"",
""target_temperature_f"": 72,
""target_temperature_c"": 21.5,
""target_temperature_high_f"": 72,
""target_temperature_high_c"": 21.5,
""target_temperature_low_f"": 64,
""target_temperature_low_c"": 17.5,
""away_temperature_high_f"": 72,
""away_temperature_high_c"": 21.5,
""away_temperature_low_f"": 64,
""away_temperature_low_c"": 17.5,
""ambient_temperature_f"": 72,
""ambient_temperature_c"": 21.5,
""RTMTKxsQTCxzVcsySOHPxKoF4OyCifrs"": {
""device_id"": ""RTMTKxsQTCxzVcsySOHPxKoF4OyCifrs"",
""software_version"": ""1.01"",
""structure_id"": ""VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3-BOLY0BA4sw"",
""name"": ""Hallway (upstairs)"",
""name_long"": ""Hallway Protect (upstairs)"",
""last_connection"": ""2014-10-31T23:59:59.000Z"",
""battery_health"": ""ok"",
""co_alarm_state"": ""ok"",
""smoke_alarm_state"": ""ok"",
""is_manual_test_active"": true,
""last_manual_test_time"": ""2014-10-31T23:59:59.000Z"",
""ui_color_state"": ""gray""
""CPMEMSnC48JlSAHjQIp-aHI72IjLYHK_ul_c54UFb8CmPXNj4ixLbg"": {
""device_id"": ""CPMEMSnC48JlSAHjQIp-kHI72IjLYHK_ul_c54UFb8CmPXNj4ixLbg"",
""serial_number"": ""1L090B50230""
""structure_id"": ""VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3-BOLY0BA4sw""
""measurement_reset_time"": ""2015-01-01T01:01:01+00:00Z"",
""measurement_time"": ""2015-01-01T01:02:35+00:00Z""
""measurement_reset_time"": ""2015-01-01T01:01:01+00:00Z"",
""measurement_time"": ""2015-01-01T01:02:35+00:00Z""
""measurement_reset_time"": ""2015-01-01T01:01:01+00:00Z"",
""measurement_time"": ""2015-01-01T01:02:35+00:00Z""
""VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3-BOLY0BA4sw"": {
""structure_id"": ""VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3-BOLY0BA4sw"",
""peyiJNo0IldT2YlIVtYaGQ""
""RTMTKxsQTCxzVcsySOHPxKoF4OyCifrs""
""CPMEMSnC48JlSAHjQIp-aHI72IjLYHK_ul_c54UFb8CmPXNj4ixLbg""
""country_code"": ""US"",
""postal_code"": ""94304"",
""peak_period_start_time"": ""2014-10-31T23:59:59.000Z"",
""peak_period_end_time"": ""2014-10-31T23:59:59.000Z"",
""time_zone"": ""America/Los_Angeles"",
""trip_id"": ""myTripHome1024"",
""estimated_arrival_window_begin"": ""2014-10-31T22:42:59.000Z"",
""estimated_arrival_window_end"": ""2014-10-31T23:59:59.000Z""
var all = JsonConvert.DeserializeObject<All>(json);
foreach (var kvp in all.devices.thermostats)
Console.WriteLine("--- Thermostat " + kvp.Key + " ---");
Thermostat t = kvp.Value;
foreach (PropertyInfo pi in typeof(Thermostat).GetProperties())
object val = pi.GetValue(t);
Console.WriteLine(pi.Name + ": " + (val != null ? val.ToString() : "(null)"));
foreach (var kvp in all.structures)
Console.WriteLine("--- Structure " + kvp.Key + " ---");
foreach (PropertyInfo pi in typeof(Structure).GetProperties())
object val = pi.GetValue(s);
Console.WriteLine(pi.Name + ": " + (val != null ? val.ToString() : "(null)"));
public Devices devices { get; set; }
public Dictionary<string, Structure> structures { get; set; }
public Dictionary<string, Thermostat> thermostats { get; set; }
public string name { get; set; }
public string country_code { get; set; }
public string time_zone { get; set; }
public string away { get; set; }
public IList<string> thermostats { get; set; }
public string structure_id { get; set; }
public int humidity { get; set; }
public string locale { get; set; }
public string temperature_scale { get; set; }
public bool is_using_emergency_heat { get; set; }
public bool has_fan { get; set; }
public string software_version { get; set; }
public bool has_leaf { get; set; }
public string device_id { get; set; }
public string name { get; set; }
public bool can_heat { get; set; }
public bool can_cool { get; set; }
public string hvac_mode { get; set; }
public double target_temperature_c { get; set; }
public int target_temperature_f { get; set; }
public double target_temperature_high_c { get; set; }
public int target_temperature_high_f { get; set; }
public double target_temperature_low_c { get; set; }
public int target_temperature_low_f { get; set; }
public double ambient_temperature_c { get; set; }
public int ambient_temperature_f { get; set; }
public double away_temperature_high_c { get; set; }
public int away_temperature_high_f { get; set; }
public double away_temperature_low_c { get; set; }
public int away_temperature_low_f { get; set; }
public string structure_id { get; set; }
public bool fan_timer_active { get; set; }
public string name_long { get; set; }
public bool is_online { get; set; }
public DateTime last_connection { get; set; }