我想将 json 字符串解析为 JSONObject 但符号“:”似乎解析错误
例如 ->"time": "2019-05-28T16:30:29Z"会出错
但是改成"time": "20190526"就OK了
这是整个 json 对象:
{
"channel": 922875000,
"sf": 12,
"time": "2019-05-28T16:30:29Z",
"gwip": "192.168.0.180",
"gwid": "00001c497b431ff5",
"repeater": "00000000ffffffff",
"systype": 170,
"rssi": -103,
"snr": 20.5,
"snr_max": 33,
"snr_min": 18,
"macAddr": "00000000aabb60ba",
"data": "00000000",
"frameCnt": 8,
"fport": 3
}
和解析代码:
try {
JSONObject sensorObject = new JSONObject(message.toString());
SensorModel sensorModel = new Gson().fromJson(sensorObject.toString(), SensorModel.class);
} catch (JSONException e) {
logger.error(e.getMessage());
}
我怎样才能让他保持相同的"2019:05:26"内容?
三国纷争
相关分类