I often need to use a text editor while writing code to paste random notes but especially JSON responses, where I format them using a plugin (for Sublime).
I recently heard about the 'scratch file' feature in IntelliJ / Android Studio which does exactly what I need it to - except I can't make it format JSON I paste in nicely.
How can I make Android Studio format JSON in a scratch buffer file?
Usage: Paste JSON string into editor, and press Reformat Code (Ctrl + Alt + L in windows) to format code as if you editing a file with . json suffix. The plugin panel will appear on the right side of the window after installed, and you don't have to restart the IDE.
IntelliJ IDEA helps you work with JSON files — it checks their syntax and formatting. In popular types of configuration files, IntelliJ IDEA provides code completion, thanks to the JSON Schema, which is a special format for describing the structure and contents of such files.
Formatting# You can format your JSON document using Ctrl+Shift+I or Format Document from the context menu.
I highlight the code and run Command Option L (a short-cut for the Code->Reformat Code menu).
On Windows use Ctrl Alt L.
Note that this only works if the code is well-formed JSON (clear any red squiggles).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With