English 中文(简体)
jq:如何在没有财产名称的情况下提取价值
原标题:jq: how to extract a value without a property name
  • 时间:2024-03-17 23:04:10
  •  标签:
  • json
  • key
  • jq

我试图将价值从一个json档案中删除。 然而,我的档案具有无财产名称的价值。

The json file, name items. json, looks:

{
  "AQ_01_Availability": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gAirQuality_01"
      ],
      "itemType": "Switch",
      "tags": [],
      "label": "Availability"
    }
  },
  "AQ_01_CO2": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gAirQuality_01"
      ],
      "itemType": "Number",
      "tags": [],
      "label": "CO2"
    }
  },
  "AQ_01_Formaldehyde": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gAirQuality_01"
      ],
      "itemType": "Number",
      "tags": [],
      "label": "Formaldehyde"
    }
  },
  "AQ_01_Humidity": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gAirQuality_01"
      ],
      "itemType": "Number",
      "tags": [],
      "label": "Humidity",
      "category": "humidity"
    }
  }
}

页: 1 每一物体的名称将退回<代码>null。

我期望的结果是:

AQ_01_Availability
AQ_01_CO2
AQ_01_Formaldehyde
AQ_01_Humidity

I have never used jq nor am I too familiar with json. My assumption was a well-structured file, thinking that each object starts with, say, item_name.

最佳回答
问题回答

暂无回答




相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...