AccountingNext/Schaad.Accounting.Db/JsonStorage.cs
Claudio Schaad acf6753d07 Use PascalCase property names in JSON data files
Property names now match the C# models (BankTransactionText instead of
bankTransactionText). Reading stays case-insensitive. The migrator test now
checks casing case-sensitively; Shouldly's ShouldContain ignores case by
default, so it never actually checked it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:44:24 +02:00

22 lines
767 B
C#

using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Schaad.Accounting.Repositories
{
/// <summary>
/// Serializer settings shared by the repositories and the XML-to-JSON migration, so both
/// produce byte-identical files.
/// </summary>
public static class JsonStorage
{
public static readonly JsonSerializerOptions Options = new()
{
// Human readable: indented, and umlauts/quotes written as-is instead of \u escapes.
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
PropertyNameCaseInsensitive = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
}
}