ProtoTest.Json 1.0.1

dotnet add package ProtoTest.Json --version 1.0.1
                    
NuGet\Install-Package ProtoTest.Json -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProtoTest.Json" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProtoTest.Json" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ProtoTest.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ProtoTest.Json --version 1.0.1
                    
#r "nuget: ProtoTest.Json, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ProtoTest.Json@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ProtoTest.Json&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ProtoTest.Json&version=1.0.1
                    
Install as a Cake Tool

ProtoTest.Json

Partial JSON shape matching and JsonValue constraints, plus the diagnostics redaction engine — the matcher shared by REST, GraphQL, gRPC and messaging.

dotnet add package ProtoTest.Json

The package arrives transitively with ProtoTest.Rest and ProtoTest.GraphQL; reference it directly for a smaller integration that only needs the matcher.

Quick start

JsonShapeMatcher.AssertMatch(json, new
{
    id = JsonValue.NotNull(),
    name = JsonValue.StringContaining("Proto"),
    score = JsonValue.Between(80, 100)
});

// A mismatch throws JsonShapeMismatchException with every mismatch attached.
try
{
    JsonShapeMatcher.AssertMatch(json, new { status = "active" });
}
catch (JsonShapeMismatchException exception)
{
    foreach (var mismatch in exception.Mismatches)
    {
        Console.WriteLine(mismatch);
    }
}

What it adds

  • Shape matcher — JsonShapeMatcher.AssertMatch(string | JsonElement, expected, options?) returns the matched JSON paths; empty or invalid JSON throws JsonDocumentAssertionException.
  • Matching rules — object shapes are partial, arrays are exact in length and position, property names are case-insensitive by default, and [JsonPropertyName], naming policy and [JsonIgnore] are honoured.
  • Value constraints — JsonValue.Any, NotNull, Null, Regex, StringContaining, StringStartingWith, StringEndingWith, StringMatching, GreaterThan, LessThan, Between, OneOf and Matching.
  • Shared traced assertion — ProtoShapeAssertion.Assert(...) records the assert.json.shape operation with expected/actual shapes and the matched property list; consumers forward an observation on success.
  • Diagnostics — JsonDiagnosticOptions defaults (RedactSensitiveData, MaxDiagnosticBodyLength, SensitiveJsonProperties) and JsonDiagnosticSanitizer used by the HTTP stack.

Extra JSON properties never fail a match, but arrays are length- and position-sensitive; numeric comparisons go through decimal/double, and describing an expected shape is capped at depth 16 and 4096 expanded containers.

Learn more

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on ProtoTest.Json:

Package Downloads
ProtoTest.Http

Shared HTTP foundations for ProtoTest protocol integrations.

ProtoTest.Messaging

Messaging integration for ProtoTest: publish and await messages with a predicate and timeout over a broker capability.

ProtoTest.Rest

Runner-independent REST integration testing for ProtoTest.

ProtoTest.GraphQL

Fluent, runner-independent GraphQL integration testing for ProtoTest.

ProtoTest.Grpc

gRPC integration for ProtoTest: named channels, metadata authentication, unary and streaming helpers, tracing and coverage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 181 9/20/2026
1.0.0 195 9/20/2026