A JetBrains IntelliJ platform plugin to format Java's default toString()
output to a JSON-like structure.
When retrieving MBean data from JConsole or VisualVM the output is being formatted using Java's toString()
method.
Though MBeans are very convenient large output becomes unreadable. Hence, I needed something to format this output.
Why JSON?
The output already looks a lot like JSON, so I figured it would be fairly easy to use JSON as target format.
- Grab the build from the Github releases or build it yourself.
- Install the plugin from IntelliJ's Plugins manager using the Cogwheel in the top right and selecting "Install plugin from disk...".
- Open and editor, optionally select the
toString()
output, open up the actions pane and select "Format Java ToString to Json". Tada, your selection should be readableā¢.
- It is not very resilient...
True, I created this for convenience, but it is definitely not monkey-proof. - Structural characters in values break the output.
This is a linear lexical formatter. Meaning it does not (really) know in what context it is currently parsing. A{
with in a string gets parsed as an object start and that's it.