numbered labels make JSON parsing difficult

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

here's what outputs lm_sensors when  I ask it to print JSON :
```
$ sensors -j | jq -r '.'
{
  "radeon-pci-0100": {
    "Adapter": "PCI adapter",
    "temp1": {
      "temp1_input": 34.000,
      "temp1_crit": 120.000,
      "temp1_crit_hyst": 90.000
    }
  },
  "coretemp-isa-0000": {
    "Adapter": "ISA adapter",
    "Package id 0": {
      "temp1_input": 32.000,
      "temp1_max": 80.000,
      "temp1_crit": 99.000,
      "temp1_crit_alarm": 0.000
    },
    "Core 0": {
      "temp2_input": 32.000,
      "temp2_max": 80.000,
      "temp2_crit": 99.000,
      "temp2_crit_alarm": 0.000
    },
    "Core 1": {
      "temp3_input": 25.000,
      "temp3_max": 80.000,
      "temp3_crit": 99.000,
      "temp3_crit_alarm": 0.000
    },
    "Core 2": {
      "temp4_input": 28.000,
      "temp4_max": 80.000,
      "temp4_crit": 99.000,
      "temp4_crit_alarm": 0.000
    },
    "Core 3": {
      "temp5_input": 26.000,
      "temp5_max": 80.000,
      "temp5_crit": 99.000,
      "temp5_crit_alarm": 0.000
    }
  }
}
```

as you can see "temps" are numbered.
imho, it's wrong JSON as it is "the same" data for different objects, and it makes it difficult* to parse to get temperature.

I noticed that the same labels are used with -u option, but it doesn't seem more reasonable.

--
* I've found solutions, but it's not as straight as JSON should be with not numbered labels.





[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux