- Paste or type JSON directly into the editor
- Import a
.jsonfile — automatically validates and checks if it's already formatted - Beautify — reformats JSON with proper indentation in place
- Validation — real-time feedback showing exactly where the JSON structure breaks (line + position)
- One-Line Version — compact single-line preview of valid JSON in the right panel
- Copy — copies the current editor content to clipboard
- Copy One-Line — copies the compact single-line version to clipboard
- Clear — resets the editor and all status indicators
- Export — saves the current editor content to a
.jsonfile - Status indicators —
JSON COMPLIANTandJSON FORMATTEDupdate live as you type or import - Line numbers — formatted view now shows line numbers alongside the highlighted JSON
- Search bar — search inside the formatted JSON; hits are highlighted and the status icon shows ✔/✘
- Edit toggle — after Beautify you can click ✎ Edit to return to the editable view with the beautified JSON
When the application opens, you will see the empty editor ready to receive JSON content. The status panel on the right shows ✗ JSON COMPLIANT and ✗ JSON FORMATTED in red, indicating no content has been entered yet. The toolbar at the bottom provides all available actions.
To load a JSON file from disk:
- Click the ↓ Import button in the bottom toolbar
- A file picker dialog will open — navigate to your
.jsonfile - Select the file and click Open
The file content will be loaded directly into the editor and automatically validated.
You can also paste JSON directly into the editor using Ctrl+V.
In the example below, a minified (single-line) JSON was pasted. Notice:
- (1) The editor shows the raw unformatted content
- (2) The status shows ✓ JSON COMPLIANT (valid structure) but ✗ JSON FORMATTED (not indented yet)
- (3) The ✦ Beautify button is ready to reformat it
After clicking ✦ Beautify, the JSON is reformatted with proper indentation in place. Notice:
- (1) ✓ JSON COMPLIANT — the JSON structure is valid
- (2) ✓ JSON FORMATTED — the JSON now follows the standard indentation format
- (3) Line numbers appear on the left of the formatted/highlighted view
The One-Line Version panel on the right also shows the compact single-line version.
The editor is fully editable — you can click anywhere in the text and modify it directly.
- (1) Click anywhere in the editor to position the cursor and edit the content
- (2) Click ⎘ Copy to copy the entire formatted JSON to clipboard
The One-Line Version panel on the right always shows a compact minified version of your valid JSON. This is useful for APIs, environment variables, or any context that requires a single-line JSON string.
- (1) Click Copy One-Line to copy the compact version
- (2) A green confirmation "One-line JSON copied!" notification appears briefly
- Type in the Search in JSON... box (header of the editor) while in the beautified view.
- Matches are highlighted in orange; the search status icon shows ✔ (found) or ✘ (not found).
- After you click ✦ Beautify, the toolbar shows ✎ Edit.
- Click ✎ Edit to return to the editable
TextBoxwith the beautified JSON content preserved. - You can beautify again at any time.
To save the current JSON content to a file:
- (1) Click ↑ Export in the bottom toolbar
- (2) A save dialog opens — choose the destination folder and type a file name
- (3) Click Save to write the file to disk
- .NET 10 SDK — required to build and run from source
# Clone the repository
git clone https://github.com/F4NT0/JsonFormatter.git
# Enter the project folder
cd JsonFormatter
# Run the application
dotnet rungit clone https://github.com/F4NT0/JsonFormatter.git && cd JsonFormatter && dotnet runThis generates a single .exe that runs on any Windows machine without needing .NET installed or any admin permissions.
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o ./publishThe output will be in the ./publish folder. Just copy JsonFormatter.exe to any Windows machine and double-click to run — no installation needed.
To target other platforms:
- Windows ARM64: replace
win-x64withwin-arm64- Linux x64: replace
win-x64withlinux-x64- macOS: replace
win-x64withosx-x64
JsonFormatter/
├── App.axaml # Application entry, dark theme, global resources
├── App.axaml.cs # Application startup
├── MainWindow.axaml # Main window UI layout (AXAML)
├── MainWindow.axaml.cs # Main window code-behind (event handlers, UI sync)
├── Program.cs # Entry point, Avalonia bootstrapping
├── app.manifest # Windows application manifest
├── JsonFormatter.csproj # Project file (.NET 10, Avalonia packages)
│
├── ViewModels/
│ └── MainWindowViewModel.cs # MVVM ViewModel — JSON state, validation, file ops
│
├── Converters/
│ ├── BoolToColorConverter.cs # IValueConverter: bool → color string
│ └── BoolToCheckConverter.cs # IValueConverter: bool → ✓ or ✗ symbol
│
├── Highlighting/
│ └── JsonHighlightingColorizer.cs # DocumentColorizingTransformer for JSON syntax colors
│
└── docs/
└── images/ # Screenshots used in this README
The application follows the MVVM (Model-View-ViewModel) pattern:
┌─────────────────────────────────────────────────────────┐
│ MainWindow.axaml │
│ (View — pure AXAML layout) │
│ TextBox Editor │ Status Dots │ One-Line Panel │ Toolbar │
└────────────────────────┬────────────────────────────────┘
│ code-behind wires events
┌────────────────────────▼────────────────────────────────┐
│ MainWindow.axaml.cs │
│ - Hooks Editor.TextChanged │
│ - Calls SyncStatus() to update named controls │
│ - Handles button clicks (Beautify, Import, Export...) │
└────────────────────────┬────────────────────────────────┘
│ reads/writes properties
┌────────────────────────▼────────────────────────────────┐
│ MainWindowViewModel.cs │
│ - JsonText → triggers ValidateJson() on set │
│ - IsJsonValid → true if JSON parses successfully │
│ - IsJsonFormatted → true if matches beautified form │
│ - ValidationMessage → friendly error with line/pos │
│ - OneLineJson → minified single-line version │
│ - BeautifyJson() → reformats _jsonText in place │
│ - ImportJson() → reads file, sets JsonText │
│ - ExportJson() → writes JsonText to file │
└─────────────────────────────────────────────────────────┘
| Technology | Version | Purpose |
|---|---|---|
| .NET | 10.0 | Runtime and build system |
| Avalonia UI | 11.3.12 | Cross-platform desktop UI framework |
| Avalonia.AvaloniaEdit | 11.3.0 | Advanced text editor component |
| Avalonia.Themes.Fluent | 11.3.12 | Fluent design theme |
| System.Text.Json | Built-in | JSON parsing and serialization |
For developers working on this project:
AvaloniaUseCompiledBindingsByDefaultmust befalsein the.csproj— setting it totruebreaks the AXAML source generator and preventsInitializeComponentandx:Namefields from being emitted.Text="{ }"in AXAML is parsed as an invalid binding expression and silently kills the source generator. Always useText="{}{ }"to escape literal curly braces.x:DataTypeon the Window must not be set — it conflicts with named control field generation.- All UI state (status dots, error bar, notification) is managed manually in code-behind via
SyncStatus()andSyncNotification()— no AXAML data bindings for these controls. - The
TextBoxeditor usesAcceptsReturn="True"andAcceptsTab="True"for multi-line JSON editing.
F4NT0 — fantolaboratorio@hotmail.com
This project is for personal/internal use. No license defined yet.







