Repository navigation
Home
m4bwav edited this page Sep 29, 2026
·
3 revisions
JsonPrettyPrinter indents JSON text one value per line, four spaces per level, in one call. It is a formatter, not a validator: it tracks strings, escapes and bracket nesting and copies everything else through as it finds it. One NuGet package of 37 KB for any .NET from Framework 4.6.2 to .NET 10, with ToJson() and DeserializeFromJson() helpers over System.Text.Json included.
dotnet add package JsonPrettyPrinter
using JsonPrettyPrinterPlus;
var pretty = """{"name":"Ada","tags":["math","engines"],"born":1815,"empty":{}}""".PrettyPrintJson();pretty is:
{
"name": "Ada",
"tags": [
"math",
"engines"
],
"born": 1815,
"empty": {}
}
- Getting started: install it in a project, a script, F# or PowerShell, and make the first call.
- API reference: every public type and member, with what it returns and throws.
- Output format: the exact rules the output follows, and what the printer never changes.
- Not a validator: trailing commas, comments, single quotes, bare words, missing brackets, and the two errors it does raise.
-
Serialisation helpers:
ToJson()andDeserializeFromJson(), serializer options, source generation, trimming and native AOT. - Recipes: files, HTTP bodies, logs, a command line tool, tests, ASP.NET, PowerShell and other serialisers.
- Performance and threading: the benchmark, allocations, streaming, and which objects can be shared between threads.
- Versions and upgrading: every release, and what to expect when moving from 1.0.1.1 or 2.0.0.
- FAQ: validation, sorting, comments, line endings, dependencies, Unity, AOT, large documents.
- Development: building, the tests, continuous integration and releasing.
- The README has the short version of all of this; nuget.org shows the same file.
- The CHANGELOG lists every release since 1.0.1.1.
- The package page: https://www.nuget.org/packages/JsonPrettyPrinter
- The 2014 article that introduced the library: https://www.markdavidrogers.com/json-pretty-printerbeautifier-library-for-net/
- Questions and bugs go to the issues.
The current version is 3.0.2 (2026-09-29). The library is MIT licensed.
This wiki describes JsonPrettyPrinter 3.0.2 and was last updated on 2026-09-30. The library is MIT licensed. Report problems in the issues.
Using it
- Getting started
- API reference
- Output format
- Not a validator
- Serialisation helpers
- Recipes
- Performance and threading
- FAQ
The releases
Contributing
Elsewhere