我的代码是
ClientRequest request1 = new ClientRequest(url);
request1.accept("application/json");
ClientResponse<String> response1 = request1.get(String.class);
System.out.println(response1);
BufferedReader br = new BufferedReader(new InputStreamReader(
new ByteArrayInputStream(response1.getEntity().getBytes())));
String output=null;
while ((output = br.readLine()) != null) {
System.out.println(output);
}
我需要从输出中提取对象 ID,然后从中获取时间戳。
输出:
{
"_id" : ObjectId("5252e015b11ce2799f84334d"),
"ConductivityChangeAlarm" : "1",
"LevelAlarm" : "1",
"WaterTankLevel" : "100cm",
"DeviceIndicator" : "1",
"HighPresuurePump" : "1",
"LowPressureAlarm" : "0",
"PremeateFlowRateDisplay" : "5gpm",
"CartridgeFilterPressureDropIncrease" : "0",
"RawWaterFlowRate" : "20gpm",
"TotaliseronHMI" : "1",
"FeedConductivityDisplay" : "500μS",
"RecirculationFlowRate" : "150gpd",
"HighPressureDisplay" : "32psi"
}