Nabs.Launchpad.Core.Serialisation 10.0.220

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Nabs.Launchpad.Core.Serialisation --version 10.0.220
                    
NuGet\Install-Package Nabs.Launchpad.Core.Serialisation -Version 10.0.220
                    
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="Nabs.Launchpad.Core.Serialisation" Version="10.0.220" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nabs.Launchpad.Core.Serialisation" Version="10.0.220" />
                    
Directory.Packages.props
<PackageReference Include="Nabs.Launchpad.Core.Serialisation" />
                    
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 Nabs.Launchpad.Core.Serialisation --version 10.0.220
                    
#r "nuget: Nabs.Launchpad.Core.Serialisation, 10.0.220"
                    
#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 Nabs.Launchpad.Core.Serialisation@10.0.220
                    
#: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=Nabs.Launchpad.Core.Serialisation&version=10.0.220
                    
Install as a Cake Addin
#tool nuget:?package=Nabs.Launchpad.Core.Serialisation&version=10.0.220
                    
Install as a Cake Tool

Nabs Launchpad Core Serialisation Library

The Nabs Launchpad Core Serialisation library provides centralized configuration and utilities for JSON and CSV serialization across the application. This library ensures consistent serialization behavior throughout your projects by providing global settings and convenient serializer wrappers.

Key Features

  • Global Configuration Management: Centralized settings for JSON and CSV serialization
  • Default JSON Serialization: Consistent camelCase formatting with indented output
  • CSV Configuration: Pre-configured CSV parsing with sensible defaults
  • Configurable Overrides: Ability to customize both JSON and CSV settings at runtime
  • Type-Safe Serialization: Strongly-typed generic methods for JSON serialization/deserialization

Core Components

GlobalSettings

The central configuration class that manages global serialization settings for both JSON and CSV formats. Provides lazy initialization with sensible defaults and allows runtime configuration overrides.

DefaultJsonSerializer

A static utility class that provides convenient methods for JSON serialization and deserialization using the configured global settings.

Usage Examples

Basic JSON Serialization

// Serialize an object to JSON
var user = new User { Name = "John Doe", Email = "john@example.com" };
var json = DefaultJsonSerializer.Serialize(user);
// Output: {
//   "name": "John Doe",
//   "email": "john@example.com"
// }

// Deserialize JSON to an object
var jsonString = """
{
  "name": "Jane Doe",
  "email": "jane@example.com"
}
""";
var user = DefaultJsonSerializer.Deserialize<User>(jsonString);

Accessing Global Settings

// Access JSON serializer options
var jsonOptions = GlobalSettings.JsonSerializerOptions;
// Default: camelCase naming policy, indented formatting

// Access CSV configuration
var csvConfig = GlobalSettings.CsvConfiguration;
// Default: InvariantCulture, headers enabled, comma delimiter

Customizing JSON Settings

// Register custom JSON serializer options
var customOptions = new JsonSerializerOptions
{
    PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
    WriteIndented = false,
    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
GlobalSettings.RegisterJsonSerializerOptions(customOptions);

// All subsequent serialization will use these settings
var json = DefaultJsonSerializer.Serialize(myObject);

Customizing CSV Settings

// Register custom CSV configuration
var customCsvConfig = new CsvConfiguration(CultureInfo.InvariantCulture)
{
    HasHeaderRecord = true,
    Delimiter = "|",  // Use pipe delimiter instead of comma
    TrimOptions = TrimOptions.Trim,
    IgnoreBlankLines = true,
    MissingFieldFound = null,
    HeaderValidated = null
};
GlobalSettings.RegisterCsvConfiguration(customCsvConfig);

// Use the configuration with CsvHelper
using var reader = new StreamReader("data.csv");
using var csv = new CsvReader(reader, GlobalSettings.CsvConfiguration);
var records = csv.GetRecords<MyDataType>();

API Reference

GlobalSettings

Properties
JsonSerializerOptions
public static JsonSerializerOptions JsonSerializerOptions { get; }

Gets the configured JSON serializer options. Returns default settings if none have been registered.

Default Settings:

  • PropertyNamingPolicy: JsonNamingPolicy.CamelCase
  • WriteIndented: true
CsvConfiguration
public static CsvConfiguration CsvConfiguration { get; }

Gets the configured CSV configuration. Returns default settings if none have been registered.

Default Settings:

  • Culture: CultureInfo.InvariantCulture
  • HasHeaderRecord: true
  • HeaderValidated: null
  • MissingFieldFound: null
  • IgnoreBlankLines: true
  • Delimiter: ","
  • TrimOptions: TrimOptions.Trim
Methods
RegisterJsonSerializerOptions
public static void RegisterJsonSerializerOptions(JsonSerializerOptions jsonSerializerOptions)

Registers custom JSON serializer options to be used globally throughout the application.

RegisterCsvConfiguration
public static void RegisterCsvConfiguration(CsvConfiguration csvConfiguration)

Registers custom CSV configuration to be used globally throughout the application.

DefaultJsonSerializer

Methods
Serialize
public static string Serialize<T>(T value)

Serializes an object to a JSON string using the global JSON serializer options.

Parameters:

  • value: The object to serialize

Returns: A JSON string representation of the object

Deserialize
public static T Deserialize<T>(string json)

Deserializes a JSON string to an object of the specified type using the global JSON serializer options.

Parameters:

  • json: The JSON string to deserialize

Returns: An object of type T

Configuration Best Practices

  1. Early Registration: Register custom settings at application startup before any serialization occurs
  2. Consistency: Use the global settings throughout your application to ensure consistent behavior
  3. Thread Safety: Note that settings are stored in static fields; register settings before multi-threaded access
  4. Testing: Reset global settings between tests to avoid test interdependencies (see testing section below)

Testing

When writing unit tests that use global settings, you should reset the static configuration between tests to ensure test isolation. The library includes a base test class pattern:

public abstract class BaseSerialisationUnitTest : IAsyncLifetime
{
    public ValueTask InitializeAsync()
    {
        // Reset static members using reflection
        ResetStaticMember(typeof(GlobalSettings), "_csvConfiguration");
        ResetStaticMember(typeof(GlobalSettings), "_jsonSerializerOptions");
        return ValueTask.CompletedTask;
    }

    public ValueTask DisposeAsync()
    {
        return ValueTask.CompletedTask;
    }

    private static void ResetStaticMember(Type type, string fieldName)
    {
        var field = type.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic);
        field?.SetValue(null, null);
    }
}

Dependencies

  • System.Text.Json: For JSON serialization functionality
  • CsvHelper: For CSV parsing and configuration
  • Ardalis.Result: For result pattern support (project reference)

Target Framework

  • .NET 10
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
10.0.221 0 2/3/2026
10.0.220 86 1/14/2026
10.0.219 94 1/5/2026
10.0.218 90 1/4/2026
10.0.217 108 1/4/2026 10.0.217 is deprecated because it is no longer maintained.
10.0.216 104 1/4/2026 10.0.216 is deprecated because it is no longer maintained.
10.0.215 111 1/4/2026 10.0.215 is deprecated because it is no longer maintained.
10.0.214 135 1/1/2026 10.0.214 is deprecated because it is no longer maintained.
10.0.213 105 1/1/2026 10.0.213 is deprecated because it is no longer maintained.
10.0.212 105 1/1/2026 10.0.212 is deprecated because it is no longer maintained.
10.0.211 110 12/31/2025 10.0.211 is deprecated because it is no longer maintained.
10.0.210 111 12/30/2025 10.0.210 is deprecated because it is no longer maintained.
10.0.209 112 12/30/2025 10.0.209 is deprecated because it is no longer maintained.
10.0.208 106 12/30/2025 10.0.208 is deprecated because it is no longer maintained.
10.0.207 109 12/29/2025 10.0.207 is deprecated because it is no longer maintained.
10.0.206 104 12/29/2025 10.0.206 is deprecated because it is no longer maintained.
10.0.205 195 12/24/2025 10.0.205 is deprecated because it is no longer maintained.
10.0.204 190 12/21/2025 10.0.204 is deprecated because it is no longer maintained.
10.0.203 286 12/18/2025 10.0.203 is deprecated because it is no longer maintained.
10.0.202 284 12/17/2025 10.0.202 is deprecated because it is no longer maintained.
10.0.200 293 12/17/2025 10.0.200 is deprecated because it is no longer maintained.
10.0.199 450 12/10/2025 10.0.199 is deprecated because it is no longer maintained.
10.0.197 190 12/5/2025 10.0.197 is deprecated because it is no longer maintained.
10.0.196 697 12/3/2025 10.0.196 is deprecated because it is no longer maintained.
10.0.195 697 12/3/2025 10.0.195 is deprecated because it is no longer maintained.
10.0.194 686 12/3/2025 10.0.194 is deprecated because it is no longer maintained.
10.0.193 693 12/2/2025 10.0.193 is deprecated because it is no longer maintained.
10.0.192 193 11/28/2025 10.0.192 is deprecated because it is no longer maintained.
10.0.190 206 11/27/2025 10.0.190 is deprecated because it is no longer maintained.
10.0.189 199 11/23/2025 10.0.189 is deprecated because it is no longer maintained.
10.0.187 184 11/23/2025 10.0.187 is deprecated because it is no longer maintained.
10.0.186 174 11/23/2025 10.0.186 is deprecated because it is no longer maintained.
10.0.184 426 11/20/2025 10.0.184 is deprecated because it is no longer maintained.
10.0.181-rc3 299 11/11/2025 10.0.181-rc3 is deprecated because it is no longer maintained.
10.0.180 309 11/11/2025 10.0.180 is deprecated because it is no longer maintained.
10.0.179-rc2 305 11/11/2025 10.0.179-rc2 is deprecated because it is no longer maintained.
10.0.178-rc2 260 11/10/2025 10.0.178-rc2 is deprecated because it is no longer maintained.
10.0.177-rc2 247 11/10/2025 10.0.177-rc2 is deprecated because it is no longer maintained.
10.0.176-rc2 212 11/6/2025 10.0.176-rc2 is deprecated because it is no longer maintained.
10.0.175-rc2 224 11/6/2025 10.0.175-rc2 is deprecated because it is no longer maintained.