diff --git a/test_data.json b/test_data.json new file mode 100644 index 0000000000000000000000000000000000000000..5641270f9a6dc2b726365e4cde044dbf4d594017 --- /dev/null +++ b/test_data.json @@ -0,0 +1,11 @@ +{ + "KPI":[ + {"Name": "Attribut_1", + "Unit": "Percentage", + "Value": 43}, + {"Name": "Attribut_2", + "Unit": "Percentage", + "Value": 56 + } + ] +} \ No newline at end of file diff --git a/trial_json.py b/trial_json.py new file mode 100644 index 0000000000000000000000000000000000000000..d28a6958c0c6452e6f09e60982ea3f5a7c119820 --- /dev/null +++ b/trial_json.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" +Created on Thu May 5 17:27:38 2022 + +@author: Richter + +testfile for operating with json-files + +""" + +import json + +with open("test_data.json","r+") as file: + data = json.load(file) + print(len(data)) + print(type(data)) + +#print(data["Name"]) + +a = data.keys() +print(a) +print(type(a)) + +for i in a: + print(i) + key = data[i] + print(len(key)) + print(type(key)) + for j in key: + attrs = list(j) + print(len(attrs)) + print(type(attrs)) + print(attrs) + print(j)