JsonSchema.Net 7.3.0

Requires NuGet 2.12 or higher.

dotnet add package JsonSchema.Net --version 7.3.0                
NuGet\Install-Package JsonSchema.Net -Version 7.3.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="JsonSchema.Net" Version="7.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonSchema.Net --version 7.3.0                
#r "nuget: JsonSchema.Net, 7.3.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.
// Install JsonSchema.Net as a Cake Addin
#addin nuget:?package=JsonSchema.Net&version=7.3.0

// Install JsonSchema.Net as a Cake Tool
#tool nuget:?package=JsonSchema.Net&version=7.3.0                

Summary

JsonSchema.Net fully implements the JSON Schema specifications, a declarative syntax for validation and annotating JSON data.

Supported specifications:

  • Draft 6 - http://json-schema.org/draft-06/schema#
  • Draft 7 - http://json-schema.org/draft-07/schema#
  • Draft 2019-09 - https://json-schema.org/draft/2019-09/schema
  • Draft 2020-12 - https://json-schema.org/draft/2020-12/schema

This project also operates as a test bed for features proposed for the next version ("draft/next").

Usage

Parse a schema:

var schema = JsonSchema.FromText(content);

Load one from a file:

var schema = JsonSchema.FromFile(filename);

Directly deserialize it:

var schema = JsonSerializer.Deserialize<JsonSchema>(content);

Or build it explicitly in code:

var schema = new JsonSchemaBuilder()
    .Comment("a comment")
    .Title("A title for my schema")
    .Type(SchemaValueType.Object)
    .Properties(
        ("foo", new JsonSchemaBuilder()
            .Type(SchemaValueType.String)
        ),
        ("bar", new JsonSchemaBuilder()
            .Type(SchemaValueType.Number)
        )
    )
    .Build();

Use the schema to evaluate and annotate data:

var instance = JsonNode.Parse("{\"foo\":\"a value\",\"bar\":42}");
var results = schema.Evaluate(instance);

Sponsorship

If you found this library helpful and would like to promote continued development, please consider sponsoring the maintainers.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (71)

Showing the top 5 NuGet packages that depend on JsonSchema.Net:

Package Downloads
Microsoft.PowerShell.Commands.Utility

Runtime for hosting PowerShell

JsonSchema.Net.Generation

Extends JsonSchema.Net to provide schema generation functionality

CycloneDX.Core

A .NET Standard library for CycloneDX bill-of-material documents.

Qart.Testing

Package Description

com.etsoo.CoreFramework

ETSOO Shared Core Framework 亿速思维共享核心框架

GitHub repositories (15)

Showing the top 5 popular GitHub repositories that depend on JsonSchema.Net:

Repository Stars
PowerShell/PowerShell
PowerShell for every system!
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
dotnet/docfx
Static site generator for .NET API documentation.
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
Version Downloads Last updated
7.3.0 46,487 12/1/2024
7.2.3 358,014 9/20/2024
7.2.2 142,537 8/18/2024
7.2.1 2,081 8/16/2024
7.2.0 62,932 8/7/2024
7.1.2 274,497 7/2/2024
7.1.1 29,529 6/28/2024
7.1.0 16,273 6/25/2024
7.0.4 349,193 6/8/2024
7.0.3 28,563 6/3/2024
7.0.2 93,502 5/13/2024
7.0.1 31,744 5/7/2024
7.0.0.3 42,177 5/1/2024
6.1.2 84,935 4/22/2024
6.1.1 7,132 4/20/2024 6.1.1 is deprecated because it has critical bugs.
6.1.0.1 104,577 4/19/2024 6.1.0.1 is deprecated because it has critical bugs.
6.1.0 29,169 4/18/2024 6.1.0 is deprecated because it has critical bugs.
6.0.7 95,162 3/25/2024
6.0.6 2,595 3/24/2024
6.0.5 78,921 3/18/2024
6.0.4 86,056 3/3/2024
6.0.3 187,635 2/19/2024
6.0.2 26,160 2/7/2024
6.0.1 15,254 2/3/2024
6.0.0 61,871 2/3/2024
5.5.1 228,179 1/21/2024
5.5.0 145,431 1/8/2024
5.4.3 81,138 12/19/2023
5.4.2 934,630 12/5/2023
5.4.1 8,258 12/2/2023
5.4.0 86,574 11/21/2023
5.3.1 420,521 11/4/2023
5.3.0 18,076 10/30/2023
5.2.7 1,271,885 10/28/2023
5.2.6 235,199 10/1/2023
5.2.5 68,766 9/10/2023
5.2.4 763 9/10/2023
5.2.3 6,192 9/8/2023
5.2.2 429 9/7/2023
5.2.1 28,837 9/1/2023
5.2.0 31,522 8/22/2023
5.1.3 68,152 8/5/2023
5.1.0 2,198 8/4/2023
5.0.0 1,942 8/2/2023
4.1.8 125,952 7/21/2023
4.1.7 2,916 7/20/2023
4.1.6 239,295 7/3/2023
4.1.5 1,044,319 6/13/2023
4.1.4 407 6/13/2023
4.1.3 2,343 6/10/2023
4.1.2 7,022 6/7/2023
4.1.1 227,126 5/5/2023
4.1.0 49,062 4/30/2023
4.0.7 1,022 4/28/2023
4.0.6 16,827 4/23/2023
4.0.5 5,702 4/20/2023
4.0.4 49,535 4/19/2023
4.0.3 101,010 4/5/2023
4.0.2 20,644 3/29/2023
4.0.1 8,815 3/27/2023
4.0.0 90,064 3/19/2023
4.0.0-beta3 5,450 2/28/2023
4.0.0-beta2 7,986 12/14/2022
4.0.0-beta1a 664 12/1/2022
3.3.2 952,458 11/13/2022
3.3.1 2,156 11/11/2022
3.3.0 34,905 11/6/2022
3.2.1 239,575 9/4/2022
3.2.0 399,988 7/11/2022
3.1.5 5,352 7/11/2022
3.1.4 10,068 7/5/2022
3.1.3 522 7/5/2022
3.1.2 13,046 6/28/2022
3.1.1 20,264 6/16/2022
3.1.0 4,030 6/15/2022
3.0.0 7,516 6/13/2022
2.4.0 113,513 5/26/2022
2.3.0 96,891 4/4/2022
2.2.1 19,526 3/31/2022
2.2.0 49,322 3/24/2022
2.1.2 18,795 3/22/2022
2.1.1 21,444 2/25/2022
2.1.0 5,681 2/23/2022
2.0.3 12,626 2/12/2022
2.0.2 13,787 2/9/2022
2.0.1 52,441 1/28/2022
2.0.0 66,538 1/13/2022
1.13.0 18,436 1/12/2022
1.12.0 50,042 12/5/2021
1.11.6 16,327 11/29/2021
1.11.5 41,376 11/11/2021
1.11.4 7,577 11/5/2021
1.11.3 130,862 9/22/2021
1.11.2 85,517 9/5/2021
1.11.1 493 9/5/2021
1.11.0 473 9/4/2021
1.10.8 16,874 8/27/2021
1.10.7 133,162 7/13/2021
1.10.6 16,843 7/2/2021
1.10.5 1,812 6/29/2021
1.10.4 22,757 6/20/2021
1.10.3 30,513 6/5/2021
1.10.2 44,223 4/17/2021
1.10.1 954 4/14/2021
1.10.0 1,743 4/10/2021
1.9.4 5,850 4/3/2021
1.9.3 30,859 3/5/2021
1.9.2 528 3/3/2021
1.9.1 24,007 2/24/2021
1.9.0 931 2/24/2021
1.8.0 7,769 2/3/2021
1.7.1 5,842 1/21/2021
1.7.0 1,861 1/17/2021
1.6.1 3,003 1/1/2021
1.6.0 7,586 12/14/2020
1.5.4 5,353 11/28/2020
1.5.3 2,568 11/26/2020
1.5.2 922 11/22/2020
1.5.1 2,058 11/3/2020
1.5.0 666 11/1/2020
1.4.0 568 10/30/2020
1.3.1 636 10/22/2020
1.3.0 986 10/17/2020
1.2.0 2,489 10/9/2020
1.1.0 796 10/5/2020
1.0.3 581 9/29/2020
1.0.2 1,792 9/1/2020
1.0.1 613 9/1/2020
1.0.0 5,019 8/29/2020
1.0.0-rc2 400 8/29/2020
1.0.0-rc1 360 8/28/2020

Release notes can be found at https://json-everything.net/json-schema