RoslynRules.Json
1.0.260915.1719
dotnet add package RoslynRules.Json --version 1.0.260915.1719
NuGet\Install-Package RoslynRules.Json -Version 1.0.260915.1719
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="RoslynRules.Json" Version="1.0.260915.1719" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RoslynRules.Json" Version="1.0.260915.1719" />
<PackageReference Include="RoslynRules.Json" />
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 RoslynRules.Json --version 1.0.260915.1719
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RoslynRules.Json, 1.0.260915.1719"
#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 RoslynRules.Json@1.0.260915.1719
#: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=RoslynRules.Json&version=1.0.260915.1719
#tool nuget:?package=RoslynRules.Json&version=1.0.260915.1719
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RoslynRules.Json
JSON serialization support for RoslynRules. Save and load workflows and rules from JSON for configuration-driven rule sets.
Installation
dotnet add package RoslynRules.Json
Usage
Serialize
using RoslynRules.Json;
using RoslynRules.Models;
var workflow = new Workflow
{
Description = "Validation rules",
Rules = new List<Rule>
{
new Rule { Description = "Adult check", Expression = "customer.Age >= 18" }
}
};
var json = JsonRuleLoader.Serialize(workflow);
File.WriteAllText("rules.json", json);
Deserialize
var workflow = JsonRuleLoader.DeserializeWorkflow(json);
workflow.Compile(new[] { new RuleParameter("customer", typeof(Customer)) });
var results = workflow.Execute(new[] { new RuleParameter("customer", typeof(Customer), customer) });
File Helpers
JsonRuleLoader.SaveWorkflowToFile(workflow, "rules.json");
var loaded = JsonRuleLoader.LoadWorkflowFromFile("rules.json");
Schema Validation
Validate JSON structure before deserialization to catch malformed files early.
// Validate during load — throws InvalidOperationException with details
var workflow = JsonRuleLoader.LoadWorkflowFromFile("rules.json", validateSchema: true);
// Or validate manually
var errors = JsonSchemaValidator.ValidateWorkflow(json);
if (errors.Count > 0)
{
Console.WriteLine(string.Join("\n", errors));
}
Validation checks: required fields, GUID format, SemVer format, correct types (boolean, integer, number), and rule array structure.
JSON Format
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Validation rules",
"version": "1.0.0",
"isActive": true,
"rules": [
{
"id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"description": "Adult check",
"expression": "customer.Age >= 18",
"isActive": true,
"priority": 0
}
]
}
Custom Options
var options = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true
};
var json = JsonRuleLoader.Serialize(workflow, options);
| Product | Versions 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.
-
net10.0
- RoslynRules (>= 1.0.260915.1719)
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 |
|---|---|---|
| 1.0.260915.1719 | 80 | 9/15/2026 |
| 1.0.260805.1833 | 122 | 8/5/2026 |
| 1.0.260721.1738 | 114 | 7/21/2026 |
| 1.0.260721.1532 | 110 | 7/21/2026 |
| 1.0.260615.1813 | 117 | 6/15/2026 |
| 1.0.260612.1729 | 118 | 6/12/2026 |
| 1.0.260609.2121 | 105 | 6/9/2026 |
| 1.0.260609.2113 | 119 | 6/9/2026 |
| 1.0.260607.2041 | 121 | 6/7/2026 |
| 1.0.260607.2032 | 117 | 6/7/2026 |
| 1.0.607.2014 | 115 | 6/7/2026 |
| 1.0.607.2009 | 119 | 6/7/2026 |
| 1.0.607.2001 | 119 | 6/7/2026 |
| 1.0.4 | 114 | 6/7/2026 |
| 1.0.2 | 118 | 6/4/2026 |
| 1.0.1 | 112 | 6/3/2026 |
| 1.0.0 | 116 | 6/3/2026 |