|
1 | | -# JsonViewer |
2 | | -This is a repository of JsonViewer . |
| 1 | +# 🚀 JSON Viewer Component for Blazor |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +A powerful, feature-rich JSON viewer component for Blazor applications with VS Code-style syntax highlighting. |
| 8 | + |
| 9 | +[](https://www.nuget.org/packages/JsonViewer.Blazor/) |
| 10 | +[](https://www.nuget.org/packages/JsonViewer.Blazor/) |
| 11 | +[](https://github.com/JsonViewer-Component/Blazor) |
| 12 | +[](https://github.com/JsonViewer-Component/Blazor/blob/main/LICENSE) |
| 13 | + |
| 14 | +[Demo](https://jsonviewer-component.github.io/Blazor/) | [Documentation](https://github.com/JsonViewer-Component/Blazor#readme) | [Report Bug](https://github.com/JsonViewer-Component/Blazor/issues) | [Request Feature](https://github.com/JsonViewer-Component/Blazor/issues) |
| 15 | + |
| 16 | +</div> |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## ✨ Features |
| 21 | + |
| 22 | +- 🎨 **VS Code-style** syntax highlighting |
| 23 | +- 🌓 **Dark & Light** theme support with persistence |
| 24 | +- 🔍 **Real-time search** with match highlighting and navigation |
| 25 | +- 📊 **JSON statistics** (size, depth, type distribution) |
| 26 | +- 📝 **Edit mode** with auto-formatting and validation |
| 27 | +- 📋 **Copy & Export** functionality |
| 28 | +- ⌨️ **Keyboard shortcuts** (Enter, Shift+Enter for search navigation) |
| 29 | +- 🔢 **Line numbers** with active line highlighting |
| 30 | +- 🎯 **Expand/Collapse** individual or all nodes |
| 31 | +- 📱 **Fully responsive** design for mobile, tablet, and desktop |
| 32 | +- ⚡ **High performance** - handles large JSON files efficiently |
| 33 | +- 🎭 **Smooth animations** and transitions |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## 📦 Installation |
| 38 | + |
| 39 | +Install via NuGet Package Manager: |
| 40 | +```bash |
| 41 | +dotnet add package JsonViewer.Blazor |
| 42 | + |
| 43 | +Or via Package Manager Console: |
| 44 | + |
| 45 | +powershell |
| 46 | +Install-Package JsonViewer.Blazor |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## 🚀 Quick Start |
| 51 | + |
| 52 | +### 1️⃣ Add namespace to `_Imports.razor`: |
| 53 | + |
| 54 | +razor |
| 55 | +@using JsonViewerComponent |
| 56 | +@using JsonViewerComponent.Components |
| 57 | + |
| 58 | +### 2️⃣ Use in your component: |
| 59 | + |
| 60 | +razor |
| 61 | +@page "/json-demo" |
| 62 | + |
| 63 | +<JsonViewer JsonData="@jsonString" IsEditable="true" /> |
| 64 | + |
| 65 | +@code { |
| 66 | +private string jsonString = @"{ |
| 67 | +""name"": ""John Doe"", |
| 68 | +""age"": 30, |
| 69 | + |
| 70 | +""hobbies"": [""reading"", ""gaming"", ""coding""] |
| 71 | +}"; |
| 72 | +} |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## 📖 Usage Examples |
| 77 | + |
| 78 | +### Read-Only Mode |
| 79 | + |
| 80 | +razor |
| 81 | +<JsonViewer JsonData="@jsonData" IsEditable="false" /> |
| 82 | + |
| 83 | +### Editable Mode with Two-Way Binding |
| 84 | + |
| 85 | +razor |
| 86 | +<JsonViewer @bind-JsonData="jsonData" IsEditable="true" /> |
| 87 | + |
| 88 | +@code { |
| 89 | +private string jsonData = "{}"; |
| 90 | +} |
| 91 | + |
| 92 | +### Dynamic JSON Loading |
| 93 | + |
| 94 | +razor |
| 95 | +<button @onclick="LoadSampleData">Load Sample</button> |
| 96 | +<JsonViewer JsonData="@jsonData" IsEditable="true" /> |
| 97 | + |
| 98 | +@code { |
| 99 | +private string jsonData = ""; |
| 100 | + |
| 101 | +private void LoadSampleData() |
| 102 | +{ |
| 103 | +jsonData = @"{""userId"": 1, ""userName"": ""Alice""}"; |
| 104 | +} |
| 105 | +} |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## ⌨️ Keyboard Shortcuts |
| 110 | + |
| 111 | +| Shortcut | Action | |
| 112 | +|----------|--------| |
| 113 | +| `Enter` | Navigate to next search match | |
| 114 | +| `Shift + Enter` | Navigate to previous search match | |
| 115 | +| `Escape` | Clear search (when search is active) | |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 🎨 Theme Support |
| 120 | + |
| 121 | +The component automatically saves your theme preference to localStorage: |
| 122 | + |
| 123 | +razor |
| 124 | +@* Theme persists across page refreshes *@ |
| 125 | +<JsonViewer JsonData="@jsonData" IsEditable="true" /> |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## 📊 JSON Statistics |
| 130 | + |
| 131 | +View detailed statistics about your JSON: |
| 132 | + |
| 133 | +- **Total Size** (bytes) |
| 134 | +- **Total Properties** |
| 135 | +- **Object Count** |
| 136 | +- **Array Count** |
| 137 | +- **Max Depth** |
| 138 | +- **Average Array Length** |
| 139 | + |
| 140 | +Access statistics via the stats button in the sidebar. |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## 🔍 Search Features |
| 145 | + |
| 146 | +- **Real-time highlighting** of all matches |
| 147 | +- **Match counter** showing current match / total matches |
| 148 | +- **Navigation buttons** to jump between matches |
| 149 | +- **Keyboard support** for quick navigation |
| 150 | +- **Case-insensitive** search |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +## 🛠️ Configuration |
| 155 | + |
| 156 | +Currently, the component works out-of-the-box with minimal configuration. Future versions will support: |
| 157 | + |
| 158 | +- Custom themes |
| 159 | +- Plugin system |
| 160 | +- Additional export formats |
| 161 | +- And more! |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## 🤝 Contributing |
| 166 | + |
| 167 | +We welcome contributions! Here's how you can help: |
| 168 | +
|
| 169 | +1. Fork the repository |
| 170 | +2. Create a feature branch (`git checkout -b feature/amazing-feature`) |
| 171 | +3. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 172 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 173 | +5. Open a Pull Request |
| 174 | +
|
| 175 | +Please read our [Contributing Guide](https://github.com/JsonViewer-Component/Blazor/blob/main/CONTRIBUTING.md) for more details. |
| 176 | +
|
| 177 | +--- |
| 178 | +
|
| 179 | +## 🐛 Bug Reports & Feature Requests |
| 180 | +
|
| 181 | +Found a bug or have an idea? Please open an issue: |
| 182 | +
|
| 183 | +- [Report a Bug](https://github.com/JsonViewer-Component/Blazor/issues/new?labels=bug) |
| 184 | +- [Request a Feature](https://github.com/JsonViewer-Component/Blazor/issues/new?labels=enhancement) |
| 185 | +
|
| 186 | +--- |
| 187 | +
|
| 188 | +## 📜 License |
| 189 | +
|
| 190 | +This project is licensed under the MIT License - see the [LICENSE](https://github.com/JsonViewer-Component/Blazor/blob/main/LICENSE) file for details. |
| 191 | +
|
| 192 | +--- |
| 193 | +
|
| 194 | +## 💖 Support |
| 195 | +
|
| 196 | +If you find this project helpful, please consider: |
| 197 | +
|
| 198 | +- ⭐ **Starring** the repository |
| 199 | +- 🐛 **Reporting bugs** or **suggesting features** |
| 200 | +- 📢 **Sharing** with others |
| 201 | +- ☕ **Sponsoring** the project |
| 202 | +
|
| 203 | +--- |
| 204 | +
|
| 205 | +## 👨💻 Author |
| 206 | +
|
| 207 | +**Parsa Panahpoor** |
| 208 | +
|
| 209 | +- GitHub: [@parsapanahpoor](https://github.com/parsapanahpoor) |
| 210 | +- Website: [Your Website](https://your-website.com) |
| 211 | +
|
| 212 | +--- |
| 213 | +
|
| 214 | +## 🌟 Acknowledgments |
| 215 | +
|
| 216 | +Special thanks to all contributors and the Blazor community! |
| 217 | +
|
| 218 | +--- |
| 219 | +
|
| 220 | +<div align="center"> |
| 221 | +
|
| 222 | +Made with ❤️ by [JsonViewer Component](https://github.com/JsonViewer-Component) |
| 223 | +
|
| 224 | +</div> |
| 225 | +
|
| 226 | +
|
| 227 | +--- |
| 228 | +
|
| 229 | +## 📂 **3. ساختار فایلها** |
| 230 | +
|
| 231 | +فایلها رو اینجوری سازماندهی کن: |
| 232 | +
|
| 233 | +Blazor/ |
| 234 | +├── .github/ |
| 235 | +│ └── workflows/ |
| 236 | +├── src/ |
| 237 | +│ ├── JsonViewerComponent/ |
| 238 | +│ │ ├── Components/ |
| 239 | +│ │ ├── JsonViewerComponent.csproj ← فایل جدید |
| 240 | +│ │ └── ... |
| 241 | +│ └── JsonViewerComponent.sln |
| 242 | +├── logo.png ← لوگوی تو |
| 243 | +├── README.md ← فایل README جدید |
| 244 | +└── LICENSE |
| 245 | +
|
| 246 | +
|
| 247 | +--- |
| 248 | +
|
| 249 | +## 🔧 **4. دستورات Build و Test** |
| 250 | +
|
| 251 | +### **مرحله 1: کپی لوگو** |
| 252 | +
|
| 253 | +```bash |
| 254 | +# اگه لوگو در پوشه دیگهای هست، کپیش کن به root |
| 255 | +cp path/to/logo.png ./logo.png |
0 commit comments