• Home
  • RSS Feed
  • Log in


JSON Formatter Plugin for IntelliJ
Posted by Erik Pragt in the early morning: February 5th, 2009

When developing an AJAX application you often end up with some data interchange format, like XML, plain text, or, in my case: JSON. The trouble with JSON, however, it that’s it’s quite hard to read. Not because it’s so complicated, but because it has been optimized for network communication, which in this case, means: all the whitespace has been stripped. Wouldn’t it be nice to have an integrated JSON formatter in your IDE to handle this? Well, now it possible!


What I did was to create a plugin for IntelliJ, to format your JSON code into some more readable (and formatted) code. Since a picture says more than a thousand words: a picture for your viewing pleasure:

IntelliJ JSON Formatter

What you can see in the screenshot is the following JSON code, but formatted:

{"glossary":{"GlossDiv":{"GlossList":{"GlossEntry":{"Abbrev":"ISO 8879:1986","Acronym":"SGML","GlossDef":{"GlossSeeAlso":["GML","XML"],"para":"A meta-markup language, used to create markup languages such as DocBook."},"GlossSee":"markup","GlossTerm":"Standard Generalized Markup Language","ID":"SGML","SortAs":"SGML"}},"title":"S"},"title":"example glossary"}}

By pasting the above in the plugin, and clicking on ‘format’, you’ll end up with the result as seen in the screenshot, which is much more readable, and thanks to the RSyntaxTextArea has colors and braces matching. The plugin doesn’t do validation yet, but this is a helpful addition to make the JSON even more readable!

So, please check out the plugin (you can install it from IntelliJ’s integrated plugin manager), install the JSON Formatter plugin and tell me what you think of it!

Share

Tags: IntelliJ, json, plugin
Filed under Java | 1 Comment »



One Response to “JSON Formatter Plugin for IntelliJ”



    Vivek Says:
    Posted at: February 9, 2009 at 10:56 pm

    Hey,

    I tried your plugin, its really good. I can suggest two features. one is converting the formatted json to xml and the other is converting it into tree structure. If you can share the code may be I can help with the development. Let me know . my email is

    vivekmongolu at gmail dot com

    Thanks,
    Vivek

    wanted to extend it further by

    Reply


Leave a Reply

Click here to cancel reply.


Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India
  • Xebia Sweden

Categories

  • Java (311)
  • Agile (181)
  • General (136)
  • Scrum (67)
  • Architecture (64)
  • Testing (59)
  • Performance (46)
  • Middleware (56)
    • Deployment (38)
  • Xebia Labs (39)
  • SOA (31)
  • Podcast (31)
  • Project Management (28)
  • Tools (26)
  • Uncategorized (20)
  • lean architecture (20)
  • Quality Assurance (17)
  • Articles (13)
  • Requirements Management (13)
  • Virtualization (19)

Tag Cloud

    Spring Groovy Concurrency Control Moving to India Oracle Lean Eclipse JPA implementation patterns Flex product owner JPA Grails Javascript agile architectuur TDD Agile Ajax Frameworks Architecture Java ACT Maven Hibernate Scrum Scala lean architecture XML lean architectuur Xebia SOA

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
Avatars by Sterling Adventures