json字符串添加转义\

String str ="{"employees":[{"firstName":"Bill","lastName":"Gates"},{"firstName":"George","lastName":"Bush"},{"firstName":"Thomas","lastName":"Carter"}]}";
String s = str.replaceAll("\"", "\\\\\"");
System.out.println(s);

posted @ 2021-06-28 21:56  Mr_sven  阅读(2230)  评论(0编辑  收藏  举报