Create new json file in pretty print format
已回答
Hello everyone,
I'm writing a small plugin for generating mock data, where as a result I get a JSON object and I need to save it to a file.
I do it this way:
file = psiFileFactory.createFileFromText("stub.json", JsonFileType.INSTANCE, JSON.std.asString(finalStub));
directory.add(file);but the Json is saved in a string format, is there some option to use PsiFileFactory that allows you to do a PrettyPrint and save the Json object not as a string?
请先登录再写评论。
You can use
com.intellij.psi.codeStyle.CodeStyleManagerto reformat the generatedPsiFile's contents.Yann Cebron Thank you so much