Documentation
Corvus.Text.Json takes the core concepts from System.Text.Json—documents,
elements, readers, writers—and reimagines them with pooled-memory parsing, mutable
document building, and full JSON Schema validation, all driven by strongly-typed,
source-generated models. These guides walk you through the core APIs and show how they relate
to the System.Text.Json types you already know. New to the library? Start with the
Getting Started tutorial, or jump straight to the
Example Recipes for practical patterns you can use right away.
Parsing & Reading JSON
Parse JSON into read-only, strongly-typed models backed by pooled memory. A high-performance alternative to System.Text.Json's JsonDocument with generic type support and zero-copy element access.
Building & Mutating JSON
Create and modify JSON documents in-place with workspace-managed pooled memory. A builder-pattern alternative to System.Text.Json's JsonNode, designed for request/response cycles and data pipelines.
Source Generator
Generate strongly-typed C# from JSON Schema at build time with the Roslyn incremental source generator. Annotate a partial struct, register your schema, and get full IntelliSense immediately.
CLI Code Generation
Generate strongly-typed C# models from JSON Schema files using the `corvusjson` CLI tool. Same output as the source generator, for CI pipelines and pre-generation workflows.
Dynamic Schema Validation
Dynamically load, compile, and validate JSON documents against JSON Schema at runtime with the runtime evaluator, ready in milliseconds with no code generation or Roslyn. Ideal for schema registries, configuration validation, and user-supplied schemas.
Migrating from V4
This guide helps you migrate code written against the V4 code generator (`Corvus.Json.CodeGeneration`, known informally as "Corvus.Json") to the V5 code generator (`Corvus.Text.Json.CodeGeneration`, known informally as "Corvus.Text.Json").
Copilot Migration
This guide shows you how to use GitHub Copilot (in VS Code, Visual Studio, or the CLI) to assist with migrating code from Corvus.Json (V4) to Corvus.Text.Json (V5).
Migration Analyzers
Complete reference for the Corvus.Text.Json migration analyzers — Roslyn diagnostics that detect V4 Corvus.Json patterns and guide you to V5 equivalents, with automatic code fixes for common transformations.
Analyzers
Built-in Roslyn analyzers and code fixes for Corvus.Text.Json — CTJ001 (prefer UTF-8 literals), CTJ002 (unnecessary conversions), CTJ003 (static match lambdas), and CTJ-NAV (navigate to JSON Schema source).
Standalone Schema Evaluator
Generate lightweight static evaluator classes for JSON Schema validation and annotation collection without creating full strongly-typed C# models. Ideal for validation-only workflows, full annotation gathering, and minimal footprint scenarios.
JSON Patch, Merge Patch & Diff
Apply RFC 6902 JSON Patch operations, RFC 7396 JSON Merge Patch, and compute diffs between documents. Build patches fluently with PatchBuilder, merge documents with ApplyMergePatch, or generate patches with CreatePatch.
JsonLogic Rule Engine
Evaluate JSON-encoded logic rules against JSON data using the interpreted evaluator, Roslyn source generator, or CLI code generator. Supports all standard JsonLogic operators, extended numeric types, and zero-allocation evaluation.
JSONata Query Language
Query and transform JSON data using the JSONata functional language. Supports interpreted evaluation, Roslyn source generator, and CLI code generation with 99.89% conformance and zero-allocation evaluation.
JMESPath Query Language
Query and extract data from JSON documents using the JMESPath query language. Supports interpreted evaluation, Roslyn source generator, and CLI code generation with zero-allocation evaluation.
YAML Converter
Convert YAML to JSON with a high-performance, zero-allocation converter supporting YAML 1.2 Core, JSON, Failsafe, and 1.1 compatibility schemas with 100% yaml-test-suite conformance.
JSON Canonicalization (JCS)
Produce a deterministic byte-exact serialization of JSON values using RFC 8785 JSON Canonicalization Scheme. Zero heap allocation on the hot path. Ideal for digital signatures, content hashing, and content-addressed storage.
JSONPath Query Language
Query and extract values from JSON documents using the JSONPath query language (RFC 9535). Supports interpreted evaluation, Roslyn source generator, and CLI code generation with zero-allocation evaluation.
OpenAPI Code Generation
Generate strongly-typed HTTP clients and ASP.NET Core server stubs from OpenAPI 2.0/3.0/3.1/3.2 specifications. Handles parameter serialization, JSON Schema validation, streaming (SSE, NDJSON), binary transfers, form-encoded bodies, and cookie authentication — all generated from a single spec.
AsyncAPI Code Generation
Generate strongly-typed producers, consumers, and handlers from AsyncAPI 2.6/3.0 specifications. Handles schema validation, typed headers, channel parameters, authentication providers, request/reply correlation, and error policies — all generated from a single spec.
AsyncAPI Message Resumption
Configure durable AsyncAPI consumers across Kafka, AMQP, MQTT, NATS JetStream, and Azure Service Bus. Covers acknowledgements, offsets, dead-letter behavior, and restart-safe processing.
TOON Converter
Convert between JSON and TOON (Token-Oriented Object Notation), an LLM-friendly JSON representation, with high-performance UTF-8-first converters for Corvus.Text.Json and System.Text.Json.
Runtime Evaluator
How the runtime JSON Schema evaluator compiles a schema into plans and evaluates them without allocation, how to turn on runtime code generation for warm validation, and what to expect when publishing an application framework-dependent, ReadyToRun or native AOT.
Consuming Generated Types
Read and build Corvus's generated strongly-typed models in your own code, allocation-free and without composing or parsing JSON strings. Covers Undefined-not-null optional properties, typed accessors and unions, the From and Build factories, the JsonElement.Source ref-safety trap, and cross-assembly type identity.
Performance Techniques
The UTF-8, byte-native, and allocation model that underpins Corvus.Text.Json's high-performance JSON handling.
Schema Evaluation Program Internals
The shape of the schema evaluation program that generated types and standalone evaluators carry, and how it is compiled and run by the runtime evaluator.
Runtime Evaluator Engineering Notes
Round-by-round engineering notes for the runtime evaluator: program images, plans, the name lookups, cold start, native AOT profiles, and every measurement against Blaze that decided each step.
Runtime Evaluator Measurements
The end-of-branch measurement tables for the runtime evaluator against Blaze over the 37 Sourcemeta corpora: cold start, warm evaluation, parse and evaluate once, compile and allocations.
JSON Schema in other languages
The Corvus JSON Schema evaluator in JavaScript, TypeScript, Rust, Python, C, C++, Swift, Ruby and PHP: the same evaluator and the same results in every language.
JavaScript and TypeScript
The Corvus JSON Schema evaluator for JavaScript and TypeScript (@corvus-dotnet/json-schema): install, validate, options, results and annotations.
Rust
The Corvus JSON Schema evaluator for Rust (the corvus-json-schema crate): install, validate, JSON text, options, results and annotations.
Python
The Corvus JSON Schema evaluator for Python (corvus-json-schema, and corvus-json-schema-rs backed by Rust): install, validate, options, results and annotations.
C
The Corvus JSON Schema evaluator for C (the corvus-json-schema C library): install, validate, options, results and annotations.
C++
The Corvus JSON Schema evaluator for C++ (the C library's header-only wrapper): install, validate, options, results and annotations.
Swift
The Corvus JSON Schema evaluator for Swift (the CorvusJsonSchema package): install, validate, options, results and annotations.
Ruby
The Corvus JSON Schema evaluator for Ruby (the corvus_json_schema gem): install, validate, options, results and annotations.
PHP
The Corvus JSON Schema evaluator for PHP (the corvus_json_schema extension, installed with PIE): install, validate, options, results and annotations.
Java and Kotlin
The Corvus JSON Schema evaluator for Java and Kotlin (io.github.corvus-dotnet:corvus-json-schema): install, validate, JSON text, options, results and annotations.
Go
The Corvus JSON Schema evaluator for Go (github.com/corvus-dotnet/Corvus.JsonSchema/src-go/corvus-json-schema): install, validate, JSON text, options, results and annotations.
Julia
The Corvus JSON Schema evaluator for Julia (CorvusJsonSchema): install, validate, JSON text, options, results and annotations.
R
The Corvus JSON Schema evaluator for R (the corvusjsonschema package): install, validate, options, results and annotations.
Object Pascal
The Corvus JSON Schema evaluator for Object Pascal (Free Pascal, written to be Delphi-compatible): install, validate, JSON text, options, results and annotations.
OCaml
The Corvus JSON Schema evaluator for OCaml (4.14 and 5.x, with no dependencies): install, validate, JSON text, options, results and annotations, threads and domains.
Fortran
The Corvus JSON Schema evaluator for Fortran, a binding to the C library (gfortran 11+ and Intel ifx, fpm and CMake): install, validate, errors, options, results and annotations.
Perl
The Corvus JSON Schema evaluator for Perl, in pure Perl (JSON::Schema::Corvus) and on the C library (JSON::Schema::Corvus::XS): install, validate, errors, options, results and annotations.
Patterns across the ports
How each Corvus evaluator matches a JSON Schema pattern, what it refuses, how it limits a match, and where the ports still differ from ECMA-262.
ECMA-262 regex translator
How the .NET evaluator and generators translate an ECMA-262 pattern to a .NET regular expression: the two grammars, what is refused, the limits of size and the known limits.
ECMA-262 regex translations
What the .NET translation writes for each ECMA-262 construct whose meaning .NET reads differently, with examples.