A high-performance command-line tool for formatting (pretty-printing) large JSON files while maintaining low memory usage.
- Memory Efficient: Processes very large JSON files without loading them entirely into memory
- Fast Processing: Optimized for speed with parallel processing support
- Flexible Options: Configurable buffer sizes, comment handling, and formatting options
- Cross-Platform: Built on .NET 9.0, runs on Windows, macOS, and Linux
- .NET 9.0 SDK or later
git clone https://github.com/nattfalk/JsonFormat.git
cd JsonFormat/src
dotnet build -c Releasedotnet run -- [options] <json-files>Or after building:
./bin/Release/net9.0/JsonFormat [options] <json-files>JsonFormat [options] <json-files>--help: Show help information--buffer-size <size>: Set buffer size in bytes (default: 65536, minimum: 1024)--allow-trailing-commas: Allow trailing commas in JSON--skip-comments: Skip JSON comments during processing--no-parallel: Disable parallel processing for multiple files--overwrite: Overwrite input files instead of creating.formatted.jsonfiles--max-depth <depth>: Set maximum parsing depth (0 for unlimited, default: 0)
Format a single JSON file:
JsonFormat data.jsonFormat multiple files with custom buffer size:
JsonFormat --buffer-size 131072 file1.json file2.json file3.jsonFormat with trailing commas allowed and overwrite original files:
JsonFormat --allow-trailing-commas --overwrite data.jsonProcess files sequentially (no parallel processing):
JsonFormat --no-parallel *.jsonJsonFormat is designed to handle very large JSON files efficiently:
- Uses streaming JSON parsing to minimize memory usage
- Configurable buffer sizes for optimal performance
- Parallel processing support for multiple files
- Low memory footprint even with gigabyte-sized JSON files
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- .NET 9.0 or later
- Initial release
- Basic JSON formatting functionality
- Memory-efficient processing
- Parallel processing support
- Configurable options