diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index 90bda4f0f3445f1f8e0dcc1c201ee9a10842a51b..9076a9846bb762b3a9672d9e3f07a29057ebc3c2 100644 --- a/adapter/ohos/Compressor.java +++ b/adapter/ohos/Compressor.java @@ -4220,12 +4220,16 @@ public class Compressor { } private static void writeGeneralRecord(List> recordList, String outPath) { + JSONArray jsonArray = new JSONArray(); try (FileWriter fileWriter = new FileWriter(outPath + LINUX_FILE_SEPARATOR + GENERAL_RECORD)) { for (HashMap record : recordList) { - String jsonString = JSON.toJSONString(record); - fileWriter.write(jsonString); - fileWriter.write(","); + JSONObject jsonObject = new JSONObject(); + for (Map.Entry entry : record.entrySet()) { + jsonObject.put(entry.getKey(), entry.getValue()); + } + jsonArray.add(jsonObject); } + fileWriter.write(jsonArray.toString()); } catch (IOException e) { LOG.error(PackingToolErrMsg.IO_EXCEPTION.toString("Write general record exist IOException: " + e.getMessage()));