ProtoTest.Json 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ProtoTest.Json --version 1.0.0
                    
NuGet\Install-Package ProtoTest.Json -Version 1.0.0
                    
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.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProtoTest.Json" Version="1.0.0" />
                    
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.0
                    
#r "nuget: ProtoTest.Json, 1.0.0"
                    
#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.0
                    
#: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.0
                    
Install as a Cake Addin
#tool nuget:?package=ProtoTest.Json&version=1.0.0
                    
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.Sheets

Spreadsheet integration for ProtoTest: open generated workbooks with ordinary OpenXML and assert on sheets, cells and ranges, with coverage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.6 0 10/4/2026
1.1.5 0 10/3/2026
1.1.4 0 10/3/2026
1.1.3 0 10/3/2026
1.1.2 0 10/3/2026
1.1.1 41 10/2/2026
1.1.0 52 10/2/2026
1.0.1 271 9/20/2026
1.0.0 207 9/20/2026