JSON 到 POJO 以获得 google 嵌套响应

JSON to POJO for google nest response

我想将来自 google nest 恒温器的 json 响应转换为 POJO 以供进一步使用。

恒温器数组包含一个设备 ID 的数组, 保存实际设备值。我不确定如何为这个恒温器列表创建 POJO 模型,谁能指导我正确的方向?

这是我从 nest 得到的 Json 回复。

{
  "thermostats": {
    "A5K29Sp2Nr1IghCYK3Jj7MF0a0pXuhxk": {
      "humidity": 65,
      "locale": "en-US",
      "temperature_scale": "C",
      "is_using_emergency_heat": false,
      "has_fan": true,
      "software_version": "4.1",
      "has_leaf": true,
      "where_id": "gPn37UwCFT5l1y8iHzATIcLKJhFieKtX0Y1GeGA_DZ5X6N7db7FRgw",
      "device_id": "A5K29Sp2Nr1IghCYK3Jj7MF0a0pXuhxk",
      "name": "Basement (FB9B)",
      "can_heat": true,
      "can_cool": false,
      "hvac_mode": "heat",
      "target_temperature_c": 21.5,
      "target_temperature_f": 71,
      "target_temperature_high_c": 26,
      "target_temperature_high_f": 79,
      "target_temperature_low_c": 19,
      "target_temperature_low_f": 66,
      "ambient_temperature_c": 24.5,
      "ambient_temperature_f": 76,
      "away_temperature_high_c": 24,
      "away_temperature_high_f": 76,
      "away_temperature_low_c": 12.5,
      "away_temperature_low_f": 55,
      "structure_id": "kg24pb09IIaJjREeEj6RmBAASwE9VgI92bfPJoIZC4yHGP2s9hqX1g",
      "fan_timer_active": false,
      "fan_timer_timeout": "1970-01-01T00:00:00.000Z",
      "name_long": "Basement Thermostat (FB9B)",
      "is_online": true,
      "hvac_state": "off"
    }
  }
}

json 中恒温器的内容应该建模为像 Map<String,Object>

这样的地图