我需要帮助将json转换为csv格式。它有1个值,具有相同值的多个属性。有人可以帮助我吗?
JSON:
{
"Parts": [{
"PartID": "P9",
"PartName": "SP9",
"Max": 10,
"Min": 2,
"VersionAva": ["PartLog"],
"TimeProperties": {
"(1)": {
"X": 1731.92,
"Y": 0.0,
"Z": 0.0,
"PartLogValues": []
},
"(2)": {
"X": 1732.22,
"Y": 4.3591343397810371,
"Z": 5.33,
"PartLogValues": []
},
"(3)": {
"X": 1732.37,
"Y": 4.3591343397810371,
"Z": 5.33,
"PartLogValues": [
"NaN"
]
},
"(4)": {
"X": 1733.44,
"Y": 4.3589598068558377,
"Z": 5.31,
"PartLogValues": [
213
]
},
"(5)": {
"X": 1733.9,
"Y": 4.3587852739306392,
"Z": 5.3,
"PartLogValues": [
4, 8, 9
]
}
}
}]
}
CSV输出为:
PartID PartName Max Min TimeProperties X Y Z PartLogValues- PartLogValues001 PartLogValues002 PartLogValues003
P9 SP9 10 2 1 1731.92 0 0
P9 SP9 10 2 2 1732.22 4.35913434 5.33
P9 SP9 10 2 3 1732.37 4.35913434 5.33
P9 SP9 10 2 4 1733.44 4.358959807 5.31 NaN
P9 SP9 10 2 5 1733.9 4.358785274 5.3 213 4 8 9