Skip to content
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": {}
}

Pages

  • 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() and DeserializeFromJson(), 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.

Elsewhere

The current version is 3.0.2 (2026-09-29). The library is MIT licensed.

Clone this wiki locally