A standalone SQL/JSON formatting tool that uses Hibernate's BasicFormatterImpl
, DDLFormatterImpl
and GSON for JSON.
Inspired by http://stackoverflow.com/questions/312552/looking-for-an-embeddable-sql-beautifier-or-reformatter
- clone this repo
mvn clean package
cd target
- (For DMLs)
java -jar sql-beautifier.jar ../src/test/resources/dml.sql
- (For DDLs)
java -jar sql-beautifier.jar -d ../src/test/resources/ddl.sql
- (For JSONs)
java -jar sql-beautifier.jar -j ../src/test/resources/sample.json
This command can consume STDIN instead of a file. If you omit filename from arguments, It starts reading input from STDIN instead.
There are jEdit macros (*.bsh in this repo) that would be very useful.