Creating JSON PSI elements from structure

Answered

Hi all,

I'm trying to develop a plugin that makes working with a very specific kind of JSON file easier for me.  So far, it's been going pretty well, but I'd like to know how I can create a series of PSI elements from text (a template, sort of, and yes, live templates is not really an option in this scenario).  I've done some reading, and found classes exist like `JavaPsiFacade` can do this, and I also examined examples (at https://www.programcreek.com/java-api-examples/index.php?api=com.intellij.psi.JavaPsiFacade), but I can't seem to find some equivalent for JSON.  Is it possible to accomplish this in some way I'm missing, or do I have to do some really strange hacking around to make it work?

Thanks in advance!

Reece

0
1 comment

Hi Reece,

You can use JsonPsiUtil.addProperty() and JsonElementGenerator methods to create properties from texts.

0

Please sign in to leave a comment.