UnitTools.SystemTextJson 1.0.2

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

UnitTools

High-performance .NET unit conversions — straightforward numeric APIs, strongly typed quantities, and precise calculations.

GitHub repository · Documentation · Release notes

UnitTools includes 150 conversion families, 1,858 registered units, and 39,458 directed non-identity conversions within compatible families. Choose direct numeric conversion, fluent extensions, typed quantities, exact decimal/rational conversion, dynamic parsing, or custom unit definitions. The core library has no third-party runtime package dependencies.

Packages

NuGet package Purpose
UnitTools Full conversion engine and quantity APIs
UnitTools.SystemTextJson Optional System.Text.Json support for typed unit values
UnitTools.Analyzers Optional Roslyn compile-time guidance

All three packages ship with the same version, currently 1.0.2. Install only the parts you need.

Installation

dotnet add package UnitTools

For JSON integration or analyzer diagnostics, install the matching companion package in addition to the core package.

Quick start

using UnitTools;
using UnitTools.Length;
using UnitTools.Quantities;

// Numeric conversion: 4 km -> 4000 m.
double meters = UnitToolsLength.Convert(
    4d,
    UnitToolsLengthUnit.Kilometer,
    UnitToolsLengthUnit.Meter);

// Fluent numeric conversion.
double fluentMeters = 4d.Convert(
    UnitToolsLengthUnit.Kilometer,
    UnitToolsLengthUnit.Meter);

// Keep the unit attached to a value.
double wrappedMeters = new UnitValue<UnitToolsLengthUnit>(
    4d, UnitToolsLengthUnit.Kilometer)
    .To(UnitToolsLengthUnit.Meter).Value;

// Compile-time dimensional safety.
Length<decimal> distance = Length<decimal>.FromKilometres(4m);
decimal typedMeters = distance.Metres;

Parsing, exact arithmetic, and composite units

double speed = UnitToolsDynamic.Convert("36 km/h", "m/s");
decimal exact = UnitToolsExact.Convert(
    1m, UnitToolsLengthUnit.Inch, UnitToolsLengthUnit.Foot);
double energy = UnitToolsComposite.Convert(1d, "N*m", "J");

Compatibility and design

  • Core: .NET Standard 2.0 and .NET 8.
  • JSON and analyzer companions: .NET Standard 2.0.
  • Standalone core without third-party runtime dependencies.
  • Exact decimal/rational paths, span-based parsing/formatting, localization, composite units, and arbitrary-scale number naming.
  • Release validation includes tests, API compatibility checks, NativeAOT smoke tests, and clean NuGet consumers.

Documentation and license

For complete APIs, sample programs, benchmarking, and supported families, visit the GitHub README.

License: Apache License 2.0 with Commons Clause v1.0. Redistribution is subject to the Commons Clause restriction on selling the software itself. Review the full license before redistribution.

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 was computed.  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.2 87 10/13/2026

1.0.1: System.Text.Json support for UnitValue<TUnit>; stable enum-name output with exact-name round-trip guarantees; catalog alias input; catalog-wide round-trip validation; explicit JSON token validation; shipped XML IntelliSense documentation; NativeAOT validation; Apache-2.0 with Commons Clause v1.0 licensing.