# JSQLFormatter
### Turn unreadable SQL into something you'd actually want to review.
A platform-independent SQL formatter, beautifier and pretty printer for the JVM — RDBMS agnostic, comment preserving, and driven entirely by the SQL grammar rather than regular expressions.
[](https://github.com/manticore-projects/jsqlformatter/actions/workflows/gradle.yml)
[](https://mvnrepository.com/artifact/com.manticore-projects.jsqlformatter/jsqlformatter)
[](https://app.codacy.com/gh/manticore-projects/jsqlformatter/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://coveralls.io/github/manticore-projects/jsqlformatter)
[](https://github.com/JSQLParser/JSqlParser)
[](#license)
[](https://github.com/manticore-projects/jsqlformatter/issues)
[](http://makeapullrequest.com)
**[Try the online demo](http://jsqlformatter.manticore-projects.com)** ·
**[Documentation](http://manticore-projects.com/JSQLFormatter/index.html)** ·
**[Samples](http://manticore-projects.com/JSQLFormatter/samples.html)** ·
**[Changelog](http://manticore-projects.com/JSQLFormatter/changelog.html)**
---
## What's new in 5.4
**A complete Visitor Pattern rewrite.** The formatter used to be one long procedural pass with roughly seventy `instanceof` checks deciding what to render. That is gone. Statements and expressions are now dispatched through JSQLParser's own visitor interfaces:
| Component | Responsibility |
|---|---|
| `StatementFormatter` | Dispatches `SELECT`, `INSERT`, `MERGE`, `UPDATE`, `DELETE`, DDL and session statements |
| `ExpressionFormatter` | Renders the full expression tower — operators, functions, `CASE`, sub-selects, literals |
| `Renderer` | Shared spelling, indentation and keyword-casing primitives |
Two things fall out of this. Adding support for a new node type is now a single `visit(...)` override instead of another branch in a growing `if`-chain. And every node type that *isn't* explicitly handled still formats sensibly: a keyword-aware fallback walks the node's own output, applies your configured keyword spelling to uppercase token runs, and passes quoted literals through untouched. No more raw, unformatted islands in the middle of an otherwise clean statement.
**Built on JSQLParser 5.3.242**, which brings massive parsing performance improvements. See [jsqlparser-bench](https://github.com/manticore-projects/jsqlparser-bench) for the numbers.
---
## Install
### Maven
```xml