Odin.Core 1.0.5

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

Odin.Core

NuGet License

Official .NET SDK for ODIN (Open Data Interchange Notation) — a canonical data model for transporting meaning between systems, standards, and AI.

Install

dotnet add package Odin.Core

Targets: netstandard2.0, net8.0

Quick Start

using Odin.Core;

var doc = Odin.Parse(@"
{policy}
number = ""PAP-2024-001""
effective = 2024-06-01
premium = #$747.50
active = ?true
");

Console.WriteLine(doc.Get("policy.number")); // "PAP-2024-001"
Console.WriteLine(doc.Get("policy.premium")); // 747.50

var text = Odin.Stringify(doc);

Core API

Method Description Example
Odin.Parse(text) Parse ODIN text into a document var doc = Odin.Parse(src);
Odin.Stringify(doc) Serialize document to ODIN text var text = Odin.Stringify(doc);
Odin.Canonicalize(doc) Deterministic bytes for hashing/signatures var bytes = Odin.Canonicalize(doc);
Odin.Validate(doc, schema) Validate against an ODIN schema var result = Odin.Validate(doc, schema);
Odin.ParseSchema(text) Parse a schema definition var schema = Odin.ParseSchema(src);
Odin.Diff(a, b) Structured diff between two documents var changes = Odin.Diff(docA, docB);
Odin.Patch(doc, diff) Apply a diff to a document var updated = Odin.Patch(doc, changes);
Odin.ParseTransform(text) Parse a transform specification var tx = Odin.ParseTransform(src);
Odin.ExecuteTransform(tx, source) Run a transform on data var result = Odin.ExecuteTransform(tx, doc);
doc.ToJson() Export to JSON var json = doc.ToJson();
doc.ToXml() Export to XML var xml = doc.ToXml();
doc.ToCsv() Export to CSV var csv = doc.ToCsv();
Odin.Stringify(doc) Export to ODIN var odin = Odin.Stringify(doc);
Odin.Builder() Fluent document builder Odin.Builder().Section("policy")...
Odin.CreateStreamingParser(handler) Streaming/SAX-style parser Odin.CreateStreamingParser(handler);

Schema Validation

using Odin.Core;

var schema = Odin.ParseSchema(@"
{policy}
!number : string
!effective : date
!premium : currency
active : boolean
");

var doc = Odin.Parse(source);
var result = Odin.Validate(doc, schema);

if (!result.Valid)
{
    foreach (var error in result.Errors)
        Console.WriteLine(error);
}

Transforms

using Odin.Core;

var transform = Odin.ParseTransform(@"
map policy -> record
  policy.number -> record.id
  policy.premium -> record.amount
");

var result = Odin.ExecuteTransform(transform, doc);

Export

var odin = Odin.Stringify(doc); // ODIN string
var json = doc.ToJson();       // JSON string
var xml  = doc.ToXml();        // XML string
var csv  = doc.ToCsv();        // CSV string

Builder

var doc = Odin.Builder()
    .Section("policy")
    .Set("number", "PAP-2024-001")
    .Set("effective", new DateOnly(2024, 6, 1))
    .Set("premium", new OdinCurrency(747.50m))
    .Set("active", true)
    .Build();

Streaming Parser

Odin.CreateStreamingParser(new OdinStreamHandler
{
    OnSectionStart = name => Console.WriteLine($"Section: {name}"),
    OnField = (key, value) => Console.WriteLine($"{key} = {value}"),
    OnSectionEnd = name => { }
});

Testing

Tests use xUnit and the shared golden test suite:

dotnet test
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.  net9.0 was computed.  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 was computed.  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. 
.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

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.5 95 5/3/2026
1.0.4 112 4/7/2026
1.0.3 101 4/6/2026