BenBurgers.InternationalStandards.Iso.Json 0.6.0

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

// Install BenBurgers.InternationalStandards.Iso.Json as a Cake Tool
#tool nuget:?package=BenBurgers.InternationalStandards.Iso.Json&version=0.6.0                

Contents

Introduction

Thank you for choosing this package.

The BenBurgers.InternationalStandards.Iso.IO package contains JSON features for codes and features that belong to standards of the International Organization for Standardization (ISO).

The International Organization for Standardization (ISO) is an international standard development organization composed of representatives from the national standards organizations of member countries. The organization develops and publishes standardization in all technical and nontechnical fields other than electrical and electronic engineering.[^1]

[^1]: Wikipedia, downloaded at 31 October 2022, 23:33 CET.

You are kindly encouraged to buy the standards you use at the ISO Store in order to fund their mission.

GitHub Sponsors

If you like my contributions, please have a look at my GitHub Sponsors profile. My open source contributions are available free of charge (but subject to licenses) and the contributions are made entirely in my free time, but sponsorship would be sincerely appreciated. Thank you.

If possible, please also buy a standard from the respective Maintenance Agency or ISO itself to cover the costs of the Maintenance Agencies and the ISO in maintaining the standards.

Packages

These are the packages that concern the ISO standards:

Name Description
BenBurgers.InternationalStandards.Iso The main package with the codes and metadata.
BenBurgers.InternationalStandards.Iso.EFCore Features for storing codes using Entity Framework Core.
BenBurgers.InternationalStandards.Iso.EFCore.SqlServer Features for storing codes using Entity Framework Core and SQL Server.
BenBurgers.InternationalStandards.Iso.IO Features for reading Code Tables from authorities.
BenBurgers.InternationalStandards.Iso.Json Features for serializing and deserializing codes in JSON.

Please refer to NuGet to download the packages and GitHub for the source code.

Manual

Supported ISO standards

The following are the currently supported ISO standards.

Name Description
ISO 639 Language codes
ISO 3166 Country codes
ISO 4217 Currency codes

ISO 639 language codes

There are JSON Converters for ISO 639 from and to the ISO 639-1, ISO 639-2T, ISO 639-2B and ISO 639-3 codes. The converters can be used directly, like in the example below, or in the JSON serializer from System.Text.Json.

Example
const Iso639Code Value = Iso639Code.Albanian;
var options = new Iso639JsonConverterOptions(Iso639AlphaMode.Part2T);
var jsonConverter = new Iso639AlphaJsonConverter(options);
using var stream = new MemoryStream();
using var utf8JsonWriter = new Utf8JsonWriter(stream);

utf8JsonWriter.WriteStartObject();
utf8JsonWriter.WritePropertyName("Albanian");
jsonConverter.Write(utf8JsonWriter, Value, new JsonSerializerOptions());
utf8JsonWriter.WriteEndObject();
utf8JsonWriter.Flush();

/*
* The result will be:
*
* {"Albanian":"sqi"}
*/

ISO 3166 country codes

There are JSON Converters for ISO 3166 from and to the alpha-2 and alpha-3 codes as well as the numeric code. The converters can be used directly, like in the example below, or in the JSON serializer from System.Text.Json.

Example
using BenBurgers.InternationalStandards.Iso.Iso3166;
using BenBurgers.InternationalStandards.Iso.Json.Iso3166.Alpha;
using System.Text.Json;

const Iso3166Code Value = Iso3166Code.Antarctica;
var options = new Iso3166JsonConverterOptions(Iso3166AlphaMode.Alpha2);
var jsonConverter = new Iso3166AlphaJsonConverter(options);
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream);

writer.WriteStartObject();
writer.WritePropertyName("Antarctica");
jsonConverter.Write(writer, Value, new JsonSerializerOptions());
writer.WriteEndObject();
writer.Flush();

/*
* The result will be:
*
* {"Antarctica":"AQ"}
*/

ISO 4217 currency codes

There are JSON Converters for ISO 4217 from and to the alpha-3 codes as well as the numeric code. The converters can be used directly or in the JSON serializer from System.Text.Json.

Example
using BenBurgers.InternationalStandards.Iso.Iso4217;
using BenBurgers.InternationalStandards.Iso.Json.Iso4217.Alpha;
using System.Text.Json;

const Iso4217Code Value = Iso4217Code.Euro;
var options = new Iso4217JsonConverterOptions();
var jsonConverter = new Iso4217AlphaJsonConverter(options);
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream);

writer.WriteStartObject();
writer.WritePropertyName("Currency");
jsonConverter.Write(writer, Value, new JsonSerializerOptions());
writer.WriteEndObject();
writer.Flush();

/*
* The result will be:
*
* {"Currency":"EUR"}
*/

ISO 8601 date and time

Each ISO 8601 value type has its own JSON converter.

  • Iso8601CalendarDateJsonConverter for Iso8601CalendarDate.
  • Iso8601DateTimeJsonConverter for Iso8601DateTime.
  • Iso8601OrdinalDateJsonConverter for Iso8601OrdinalDate.
  • Iso8601TimeJsonConverter for Iso8601Time.

Supported Languages

The supported languages in the ISO packages are:

ISO 639-1 Name
neutral
en English
fr French
nl Dutch

More may be added in the future.

Product Compatible and additional computed target framework versions.
.NET 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 is compatible. 
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
0.6.0 77 11/24/2024
0.5.0 261 12/5/2023
0.4.0 370 1/3/2023
0.3.0 356 11/15/2022
0.2.0 362 11/9/2022
0.1.0 385 11/4/2022

Version 0.6.0
- .NET 9.0 support, .NET 6.0 and .NET 7.0 deprecated.
- .NET Entity Framework Core 8 and 9 support.
Version 0.5.0
- .NET 8.0 support.
Version 0.4.0
- Added Entity Framework Core features for value converters and model builders.
- ISO 3166: Breaking change; Iso3166AlphaMode moved from JSON package to main package.
- ISO 3166: Country codes are now generated from the data from the ISO 3166 Maintenance Agency (Online Browsing Platform), some field names may have changed. Properties "Independent" and official full names and short names in some languages added.
- ISO 639, 3166, 4217: Comparers added.
- ISO 639, 3166, 4217: Added ToModel method for retrieving the full model of an ISO code.
- ISO 639, 3166, 4217: Added TryTo[ISO] method for attempting to convert a string to its ISO code equivalent, without throwing an exception if it fails.
- ISO 8601: Added ISO 8601 date and time value types, including EFCore and JSON converters.
- If .NET 6.0 use official .NET 6.0 packages, if .NET 7.0 use official .NET 7.0 packages.
Version 0.3.0
- ISO 639: Fixed bug; if an unassigned Part of ISO 639 was requested, an exception was thrown that said it was deprecated.
- ISO 639: Implemented stub for conversion from string to ISO 639 code.
- ISO 3166: Improved documentation.
- ISO 4217: Added ISO 4217 currency codes.
- ISO 4217/IO: Added ISO 4217 Input/Output for importing currency codes from authority.
- ISO 4217/JSON: Added ISO 4217 (de)serialization.
Version 0.2.0
- ISO 639: Added ISO 639 language codes.
- ISO 639/IO: Added ISO 639 Input/Output for importing Code Tables from authority.
- ISO 639/JSON: Added ISO 639 (de)serialization.
- ISO 3166/JSON: Support for reading (in addition to writing) ISO 3166 numeric code as string.
- Added support for .NET 7.0 .
Version 0.1.0
- ISO 3166: Added ISO 3166 country codes.
- ISO 3166/JSON: Added ISO 3166 (de)serialization.