如何将它们分开打印?我想分别获得GPS ID,GPS Mod。因为我正在使用这些项目。
例如,我已经尝试过
gps[TM_GPS_ID].f = tlmtrArray[i].toObject()["GPS ID"].toDouble();
QString GpsId =
QString::number(gps[TM_GPS_ID].f);但它不起作用
{
"A":
[
{
"GPS":
[
{
"GPS ID":[
"integer",
"0"
],
"GPS Mod":[
"integer",
"1"
],
"GPS Utc":[
"float",
"2"
],
"GPS Latitude":[
"float",
"3"
],
"GPS Longitude":[
"float",
"4"
]
}
]
}
]
}发布于 2021-03-24 19:12:24
字段"GPS ID"不包含单个值,它包含一个数组。你必须继续解压你的数据,直到达到你想要的数值。
替换:
gps[TM_GPS_ID].f = tlmtrArray[i].toObject()["GPS ID"].toDouble();通过以下方式:
gps[TM_GPS_ID].f = tlmtrArray[i].toObject()["GPS ID"].toArray()[1].toDouble();其他字段也是如此。
https://stackoverflow.com/questions/66758437
复制相似问题