我正在通過 Java 和 JSON.simple 庫將一些數據打印到一個 json 文件中,但是只要有一個斜杠,我就會添加一個反斜杠,如下所示:"thing":[ {"file":"Screenshot_from_2018-07-12_14-41-19.png", "currentDateTime":"02\/08\/2018 15:11:14", "selectedDate":"02\/08\/2018", "uri":"\/var\/stuff\/files\/Screenshot_from_2018-07-12_14-41-19.png", "user":"user"} ]它發生在我們將地圖傳遞給 JSONObject 的那一刻: map.put("file", fileNameFormat); map.put("uri", filesPath + "/" + service + "/" + fileNameFormat); map.put("user", user); map.put("selectedDate", selectedDate); map.put("currentDateTime", currentDateTime); JSONObject json = new JSONObject(map); //HERE我認為當我進一步開發該實用程序時,這將是一個問題。為什么會發生這種情況,我該如何繞過它?提前致謝。
Java / JSON.simple - 在斜杠前打印反斜杠
幕布斯6054654
2021-06-18 18:29:51