Tuesday, 14 February 2012

Edit Json files in Eclipse

JSON is becoming more and more popular. Few times ago, I have written a post explaining the basic functions to handler it in Java.

To edit a JSON file, an IDE like Eclipse could be used. One of the functions is that it can format the json file for you. To use this function in Eclipse, you should install an plugin called "JSON Edit" which you can find it in SourceForge: http://sourceforge.net/projects/eclipsejsonedit/

Actually the last version is 0.9.4.

Once downloaded, you can install it by:

1. Descompress the zip file. You will see two folders: plugins and features
2. Copy the content of the features (json.editor.plugin.feature_0.9.4.jar) into the folder of eclipse:
    Eclipse -> features
3. Copy the content of the plugins (json.editor.plugin_0.9.4.jar) into the folder of eclipse:
    Eclipse -> plugins
4. Restart eclipse.

If everything went well, you should able to see the "Json Editor" in the preferences:

Source: SourceForge

Then, for any json file, you can open it with the Json editor if it is in the explorer of eclipse:
Source: StackOverFlow

Finally, you can choose the option "Format text" option in Edit menu to format the Json content.

6 comments:

  1. Nice article..Very much useful as there are not many JSON editors in the market.

    ReplyDelete
  2. Excellent! Thanks for explaining this.

    ReplyDelete
  3. Replies
    1. I am not sure that it gives you a tree view. You might try it on this online json editor:

      http://jsonviewer.stack.hu/

      You just have to paste the text and click on viewer.

      Delete