Nullean.Snapshots.Json 0.12.1

dotnet add package Nullean.Snapshots.Json --version 0.12.1
                    
NuGet\Install-Package Nullean.Snapshots.Json -Version 0.12.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="Nullean.Snapshots.Json" Version="0.12.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nullean.Snapshots.Json" Version="0.12.1" />
                    
Directory.Packages.props
<PackageReference Include="Nullean.Snapshots.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 Nullean.Snapshots.Json --version 0.12.1
                    
#r "nuget: Nullean.Snapshots.Json, 0.12.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 Nullean.Snapshots.Json@0.12.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=Nullean.Snapshots.Json&version=0.12.1
                    
Install as a Cake Addin
#tool nuget:?package=Nullean.Snapshots.Json&version=0.12.1
                    
Install as a Cake Tool

Nullean.Snapshots.Json

snapshots.

JSON snapshots and inline JSON assertions for Nullean.Snapshots, compared as trees: key order ignored, numbers by value, differences reported by path with the line and column in the verified file.

NuGet

Install

dotnet add package Nullean.Snapshots.Json

Quick start

using System.Text.Json.Serialization;
using AwesomeAssertions;
using Nullean.Snapshots.Json;
using Nullean.Snapshots.Trees;

public record Order(int Id, string Product, DateTimeOffset CreatedAt);

[JsonSerializable(typeof(Order))]
public partial class AppJson : JsonSerializerContext;

public class OrderTests
{
	[Test]
	public void Serializes()
	{
		var order = new Order(3, "kibana", DateTimeOffset.UtcNow);
		var diff = new TreeDiffOptions { IgnorePaths = ["$.CreatedAt"] };
		order.Should().MatchJsonSnapshot(AppJson.Default.Order, diff); // source-generated: AOT-safe
	}

	[Test]
	public void Inline() =>
		"""{ "name": "Kibana", "id": 2 }""".Should().MatchInlineJsonSnapshot("""
			{ "id": 2, "name": "Kibana" }
			""");
}
  • MatchJsonSnapshot takes JSON text, or an object with a JsonTypeInfo<T> (source-generated, AOT-safe) or JsonSerializerOptions (reflection).
  • TreeDiffOptions ignores volatile paths ($.meta.generatedAt, $..id) or makes key order and number form count (StrictNumbers).
  • BeJson and MatchInlineJsonSnapshot compare with JSON written in the test.
  • Use the text MatchSnapshot instead when the exact bytes matter, such as whitespace or key order on the wire.

Learn more

Product Compatible and additional computed target framework versions.
.NET 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.12.1 0 11/12/2026
0.12.0 0 11/12/2026
0.11.0 19 11/11/2026
0.10.1 46 11/11/2026
0.10.0 54 11/11/2026
0.9.0 38 11/11/2026
0.8.1 159 11/11/2026
0.8.0 120 11/11/2026
0.7.0 211 11/10/2026
0.6.0 225 11/5/2026
0.5.0 86 11/5/2026
0.4.0 541 11/5/2026
0.3.0 87 11/4/2026
0.2.0 93 11/3/2026
0.1.0 91 11/3/2026