mosquito_sub 给jq取值

mosquito_sub to jq get value

我在 linux bash 上有 MQTT mosquitto_sub 运行 输出从电源插头收到的 JSON 数据:

#mosquitto_sub -t stat/sensors/# | jq -r '.'
{
  "Status": {
    "Module": 52,
    "FriendlyName": [
      "stecker2"
    ],
    "Topic": "sensors",
    "ButtonTopic": "0",
    "Power": 0,
    "PowerOnState": 3,
    "LedState": 1,
    "SaveData": 1,
    "SaveState": 1,
    "SwitchTopic": "0",
    "SwitchMode": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0
    ],
    "ButtonRetain": 0,
    "SwitchRetain": 0,
    "SensorRetain": 0,
    "PowerRetain": 0
  }
}

如何查询 "Power": 0 值?我只需要“0”。 我试过

jq -r '.Power'

但只有 returns

null

一种方法是“向下钻取”:

.Status.Power