import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class TestMainArgs {
public static void main(String[] args) throws IOException {
String fileName = "D:" + File.separator + "a.txt";//将要转换格式的文本放到a.txt,放在D盘下,取得路径
File f = new File(fileName);
InputStream in=new FileInputStream(f);
byte[] b=new byte[(int)f.length()];
in.read(b);
in.close();
String str=new String(b);//
System.out.println("原文: "+str);
System.out.println("格式化后: "+str.replace("{\"", "\n").replace("\":\"", "==")); //替换{"为换行,替换":"为== ,要格式化其他的,在str.replace("{\"", "\n").replace("\":\"", "==")添加
}
}