如何使用 JQ (JSON) 获取价值

如何使用 JQ (JSON) 获取价值

我想获取 result.data 的值(但它给了我 null)有人可以解释一下下面的 json 中的定位是如何工作的。不明白。

{
   "ActTime" : 1547809207,
   "AstrTwilightEnd" : "19:02",
   "AstrTwilightStart" : "06:37",
   "CivTwilightEnd" : "17:40",
   "CivTwilightStart" : "07:59",
   "DayLength" : "08:23",
   "NautTwilightEnd" : "18:22",
   "NautTwilightStart" : "07:17",
   "ServerTime" : "2019-01-18 12:00:07",
   "SunAtSouth" : "12:05",
   "Sunrise" : "08:38",
   "Sunset" : "17:01",
   "app_version" : "4.9700",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 18,
         "Data" : "On",
         "Description" : "",
         "DimmerType" : "none",
         "Favorite" : 0,
         "HardwareID" : 7,
         "HardwareName" : "Iphone Gert-Jan",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "000141F8",
         "Image" : "Phone",
         "IsSubDevice" : false,
         "LastUpdate" : "2019-01-18 11:49:18",
         "Level" : 0,
         "LevelInt" : 0,
         "MaxDimLevel" : 100,
         "Name" : "Iphone Gert-Jan",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "On",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "Selector Switch",
         "SwitchType" : "On/Off",
         "SwitchTypeVal" : 0,
         "Timers" : "false",
         "Type" : "Light/Switch",
         "TypeImg" : "lightbulb",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "424"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

[.result][][].data什么也不返回

答案1

已经弄清楚了..我忘记区分大小写。使用数据而不是数据。

相关内容