A powerful, feature-rich JSON viewer component for Blazor applications with VS Code-style syntax highlighting.
- π¨ VS Code-style syntax highlighting
- π Dark & Light theme support with persistence
- π Real-time search with match highlighting and navigation
- π JSON statistics (size, depth, type distribution)
- π Edit mode with auto-formatting and validation
- π Copy & Export functionality
- β¨οΈ Keyboard shortcuts (Enter, Shift+Enter for search navigation)
- π’ Line numbers with active line highlighting
- π― Expand/Collapse individual or all nodes
- π± Fully responsive design for mobile, tablet, and desktop
- β‘ High performance - handles large JSON files efficiently
- π Smooth animations and transitions
Install via NuGet Package Manager:
dotnet add package JsonViewer.BlazorOr via Package Manager Console:
Install-Package JsonViewer.Blazor@using JsonViewerComponent
@using JsonViewerComponent.Components@page "/json-demo"
<JsonViewer JsonData="@jsonString" IsEditable="true" />
@code {
private string jsonString = @"{
""name"": ""John Doe"",
""age"": 30,
""email"": ""[email protected]"",
""hobbies"": [""reading"", ""gaming"", ""coding""]
}";
}<JsonViewer JsonData="@jsonData" IsEditable="false" /><JsonViewer @bind-JsonData="jsonData" IsEditable="true" />
@code {
private string jsonData = "{}";
}<button @onclick="LoadSampleData">Load Sample</button>
<JsonViewer JsonData="@jsonData" IsEditable="true" />
@code {
private string jsonData = "";
private void LoadSampleData()
{
jsonData = @"{""userId"": 1, ""userName"": ""Alice""}";
}
}| Shortcut | Action |
|---|---|
Enter |
Navigate to next search match |
Shift + Enter |
Navigate to previous search match |
Escape |
Clear search (when search is active) |
The component automatically saves your theme preference to localStorage:
@* Theme persists across page refreshes *@
<JsonViewer JsonData="@jsonData" IsEditable="true" />View detailed statistics about your JSON:
- Total Size (bytes)
- Total Properties
- Object Count
- Array Count
- Max Depth
- Average Array Length
Access statistics via the stats button in the sidebar.
- Real-time highlighting of all matches
- Match counter showing current match / total matches
- Navigation buttons to jump between matches
- Keyboard support for quick navigation
- Case-insensitive search
Currently, the component works out-of-the-box with minimal configuration. Future versions will support:
- Custom themes
- Plugin system
- Additional export formats
- And more!
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read our Contributing Guide for more details.
Found a bug or have an idea? Please open an issue:
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this project helpful, please consider:
- β Starring the repository
- π Reporting bugs or suggesting features
- π’ Sharing with others
- β Sponsoring the project
Parsa Panahpoor
- GitHub: @parsapanahpoor
- Website: Your Website
Special thanks to all contributors and the Blazor community!
Made with β€οΈ by JsonViewer Component
