"Services": {
"RoadAttributes": {
"egoInformation": [
{
"roundabout": {
"id": 5,
"value1": 5,
"source": 5
},
"tollStation": {
"id": 5,
"value1": 5,
"source": 5
},
"railroadcrossing": {
"id": 5,
"value1": 5,
"source": 5
},
"speedbump": {
"id": 5,
"value1": 5,
"source": 5
},
"tunnel": {
"id": 5,
"value1": 5,
"source": 5
},
"urbanArea": {
"id": 5,
"value1": 5,
"source": 5
},
"streetClass": {
"id": 5,
"value1": 5,
"source": 5
},
"functionalRoadClass": {
"id": 5,
"value1": 5,
"source": 5
},
"constructionSite": {
"id": 5,
"value1": 5,
"source": 5
},
"laneIndexEgo": {
"id": 5,
"value1": 5,
"source": 5
},
"laneNumbers": {
"id": 5,
"value1": 5,
"value2": 5,
"source": 5
},
"laneAcceleration": {
"id": 5,
"value1": 5,
"value2": 5,
"source": 5
},
"laneDeceleration": {
"id": 5,
"value1": 5,
"value2": 5,
"value3": 5,
"source": 5
},
"laneWidth": {
"id": 5,
"value1": 5,
"source": 5
},
"structuralSeperation": {
"id": 5,
"value1": 5,
"source": 5
},
"ramp": {
"id": 5,
"value1": 5,
"source": 5
},
"insideCity": {
"id": 5,
"value1": 5,
"source": 5
},
"crosswalk": {
"id": 5,
"value1": 5,
"source": 5
},
"intersection": {
"id": 5,
"value1": 5,
"value2": 5,
"source": 5
},
"relativeYawAngle": 5,
"messageCounter": 4
}
]
}}
字符串
JSON数据与Excel列x1c 0d1x进行比较
import json
import json as js
# Read the JSON file
with open("ampmin.json") as f:
data = js.load(f)
# Temp_Data=data['Services']
# print(Temp_Data)
for d in data:
Temp_Data = d['Services']
型
我没有尝试与上述代码,并试图读取JSON,有很多服务条目在我的JSON文件中,我想比较他们与我的Excel参数,如果匹配发现通知我们,但不知道如何乐观地检索参数,并与Excel参数比较?任何帮助将不胜感激,谢谢!
1条答案
按热度按时间wvt8vs2t1#
我不明白你想拿什么来比较...
.但是如果你有嵌套的
JSON
,那么你需要嵌套的for
-循环。在每个
for
-循环中,您可以使用type()
检查嵌套元素中的内容-list
或dict
-并决定是否需要使用for item in list
或for key, val in dict.items()
此代码
字符串
给了我:
型