jEdit Community - Resources for users of the jEdit Text Editor
Needed JSON Formatter Plugin
Submitted by bigjim on Tuesday, 16 June, 2009 - 18:39
Does anyone have or is anyone working on plugin for formatting JSON data similar to the XML Indenter plugin? With JSON becoming a popular protocal for those developing rich web applications it would be real useful to be able to take a long JSON string intended for computer processing and format it in a way a human could read it.

Thanks,
Jim
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
It's not exactly what you wan
by elberry on Thu, 18/06/2009 - 22:21
It's not exactly what you want, but I have a macro which I use to format the current buffer according to jEdit's mode definition. This has some auto indention stuff built in.
[code]
JEditTextArea jeTextArea = (JEditTextArea)textArea;
String originalText = jeTextArea.getText();
jeTextArea.setText("");
for(int i = 0; i < originalText.length(); i++) {
	jeTextArea.userInput(originalText.charAt(i));
}
[/code]
Just copy and paste that into a new buffer, and save it under your [settings_dir]/macros directory somewhere.

I have mine saved as [settings_dir]/macros/Development/Format.bsh

Then you can find and execute the macro from the Macros menu.

I also have some local changes to my javascript.xml file to handle '['s better.

If you open [install_dir]/modes/javascript.xml

Just change these two properties to look like this:
[code]
		<PROPERTY NAME="indentOpenBrackets" VALUE="{[" />
		<PROPERTY NAME="indentCloseBrackets" VALUE="]}" />
[/code]
Learn from the past. Live in the present. Plan for the future.
11101000
Blog
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300