hab folgende JSON-Datei:
Code: Alles auswählen
{
"generalConfig": [
{
"name": "Letzte \u00c4nderung",
"background-color": "",
"flag": "Qt::ItemIsEditable",
"currentValue": {
"currentValue": "25.01.2019 10:25",
"background-color": "#6E6E6E",
"flag": "",
"role": "InputField",
"valid": "(\\d+[.,]?\\d+)"
},
"lowerTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"upperTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"status": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
}
},
{
"name": "Solldrehzahl",
"background-color": "",
"flag": "Qt::ItemIsEditable",
"currentValue": {
"currentValue": 1200.0,
"background-color": "#6E6E6E",
"flag": "",
"role": "InputField",
"valid": "(\\d+[.,]?\\d+)"
},
"lowerTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"upperTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"status": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
}
},
{
"name": "Abstand a",
"background-color": "",
"flag": "Qt::ItemIsEditable",
"currentValue": {
"currentValue": "5.0",
"background-color": "#6E6E6E",
"flag": "",
"role": "InputField",
"valid": "(\\d+[.,]?\\d+)"
},
"lowerTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"upperTolerance": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
},
"status": {
"currentValue": "",
"background-color": "#EFE9E9",
"flag": "",
"role": "InputField"
}
}
.
.
.
.
.
Bis jetzt habe ich folgenden Code:
Code: Alles auswählen
import json
from pprint import pprint
with open('newmain.json', 'r') as f:
distros_dict = json.load(f)
print(distros_dict["generalConfig"])
nur weis ich jetzt leider nicht wie ich auf "status" bzw. "currentValue" zugreifen kann ...
Jemand eine Idee?