|
|
@@ -29,7 +29,12 @@ public class JsonExtractor {
|
|
|
newJson.put("productId", orginalObj.getString("productId"));
|
|
|
newJson.put("userId", orginalObj.getString("userId"));
|
|
|
newJson.put("deviceId", orginalObj.getString("deviceId"));
|
|
|
+ newJson.put("address", orginalObj.getString("address"));
|
|
|
+ newJson.put("port", orginalObj.getIntValue("port"));
|
|
|
newJson.put("deviceSecret", orginalObj.getString("deviceSecret"));
|
|
|
+ //老版本兼容
|
|
|
+ newJson.put("deviceName", orginalObj.getString("deviceName"));
|
|
|
+ newJson.put("productKey", orginalObj.getString("productKey"));
|
|
|
Object wifi = orginalObj.get("wifi");
|
|
|
if (wifi instanceof String) {
|
|
|
// 如果 wifi 是字符串,尝试将其解析为 JSON 数组
|
|
|
@@ -37,13 +42,6 @@ public class JsonExtractor {
|
|
|
}
|
|
|
newJson.put("wifi", wifi);
|
|
|
|
|
|
- //老版本
|
|
|
- newJson.put("address", orginalObj.getString("address"));
|
|
|
- newJson.put("port", orginalObj.getIntValue("port"));
|
|
|
- newJson.put("deviceName", orginalObj.getString("deviceName"));
|
|
|
- newJson.put("deviceSecret", orginalObj.getString("deviceSecret"));
|
|
|
- newJson.put("productKey", orginalObj.getString("productKey"));
|
|
|
-
|
|
|
//将新的JSON对象转换成字符串
|
|
|
return newJson.toJSONString();
|
|
|
} catch (Exception e) {
|