I am trying to get values out of a json file. However, my file has a value without a property name.
The json file, names items.json, looks like this:
{"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" } }}
I thought jq .items[0] items.json
would return the name of each object; but it returns null
.
My desired result would be:
AQ_01_AvailabilityAQ_01_CO2AQ_01_FormaldehydeAQ_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
.