I have this json file:
"compileFlags": {
"useVarcharZplitterRemoveIf": false,
"useVarcharZplitterSortVal": false,
"useVarcharZplitterSortKey": false,
"useVarcharZplitterJoinVal": false,
"useVarcharZplitterJoinKey": true,
},
"runtimeFlags": {
"useShortcutJoin": true,
"useMemorySpool": true,
},
"runtimeGlobalFlags": {
"useMetadataServer": true,
"metadataServerIp1": 127,
},
"server":{
"gpu": 0,
"port": 5000,
}
}
I want to be able to count each object inside this json file , for example: compileFlags=5 (beacuse it got 18 items under its name) runtimeFlags=2
This is my code:
with open(json_file_path, "r") as f:
data = json.load(f)
print(len(data["compileFlags"]))
print(len[data["runtimeFlags"]])
print(len[data["runtimeGlobalFlags"]])
print(len[data["server"]])
read_json_file(path_to_json_file_location)
When I am running it I am getting the following error message:
TypeError: 'builtin_function_or_method' object is not subscriptable
What am I doing wrong?
len[data["runtimeFlags"]]should belen(data["runtimeFlags"])and all lines below.