WritableJsonConfiguration 8.1.2

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

WritableJsonConfiguration

<img src="https://github.com/Kibnet/WritableJsonConfiguration/raw/master/resources/JSON_logo.png" alt="JSON" width="180"/>

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image GitHub last commit GitHub code size in bytes

GitHub search hit counter Nuget

What is it?

If you want to add a settings to your app and you like json, then this is what you need. This uses the standard interface for working with settings, which is provided by Microsoft.Extensions.Configuration. To do this, we added methods for changing values in settings via the standard interface, which will edit the json file themselves.

How to use?

Add Nuget Package in your project:

Install-Package WritableJsonConfiguration

Create configuration:

IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create("Settings.json");

Use this configuration in the app as you need, usually people register it with the IoC, example(Splat):

Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));

Get value:

Themes theme = configuration.GetSection("Appearance:Theme").Get<Themes>();

or

Themes theme = configuration.Get<Themes>("Appearance:Theme");

Set value:

configuration.GetSection("Appearance:Theme").Set(theme);

or

configuration.Set("Appearance:Theme", theme);

Opt-in atomic writes on Windows

IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create(source =>
{
    source.Path = "Settings.json";
    source.Optional = true;
    source.ReloadOnChange = false;
    source.UseAtomicWrites = true;
    source.ResolveFileProvider();
});

UseAtomicWrites defaults to false, preserving the previous API and platform behavior. When enabled, both Set overloads serialize writes to the same physical path within the process. A complete, parser-validated temporary file is flushed and replaces the main file; .bak contains the previous readable version. A first save creates only the main file. No-op saves do not rotate the backup. Memory is published after the file commit; ambiguous I/O errors reread disk and block further writes if reconciliation fails. Restart the application or recreate the configuration root before trying again in that case; calling Reload() on the same root does not unblock writes. Numeric path segments remain property names inside JSON objects. Inside arrays they are indexes; sparse indexes are rejected rather than redirected to another element.

Temporary files receive the source file's restricted Windows access permissions before any settings bytes are written. Existing main/backup permission differences that cannot safely be preserved cause an error, not a broader copy. The first file uses the containing directory's permissions. Other operating systems reject explicit opt-in with PlatformNotSupportedException; the default mode remains available.

This does not recover an already corrupt file, coordinate multiple processes, make a series of Set calls transactional, or guarantee survival of arbitrary hardware failure. Applications should validate/recover settings before loading configuration. Backups and leftover temporary files may contain secrets and must not be published.

Communication

Any suggestions and comments are welcome. If you want to contact me, use Telegram

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 (1)

Showing the top 1 popular GitHub repositories that depend on WritableJsonConfiguration:

Repository Stars
SimpleStateMachine/SimpleStateMachineNodeEditor
🔗WPF node editor based on ReactiveUI
Version Downloads Last Updated
8.1.2 208 9/21/2026
8.1.1 94 9/21/2026
8.1.0 89 9/21/2026
8.0.1 2,702 12/12/2025
8.0.0 3,927 3/1/2024
6.0.0 4,358 8/2/2022
3.1.9 14,439 10/24/2020
3.1.8 691 10/5/2020
3.1.5 2,192 7/10/2020

Fix false atomic-write ACL mismatches after Windows normalizes equivalent file access entries during File.Replace.