You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Note is marked [JsonConstructor] but System.Text.Json serializes its key as a char array and can't deserialize it #122
Note (Keybinding/Models/MusicalTypes.cs, around line 17) has a [JsonConstructor], which tells consumers they can serialize it directly. However, NoteName is a SemanticString, and System.Text.Json treats it as a collection of chars:
JsonSerializer.Serialize(newNote("Ctrl"));// {"Key":["C","T","R","L"]}JsonSerializer.Deserialize<Note>("{\"Key\":\"CTRL\"}");// JsonException: could not be converted to NoteName. Path: $.Key
Deserializing the library's own serialized output also fails: NotSupportedException: The collection type 'NoteName' is abstract, an interface, or is read only.
The library's own persistence goes through string DTOs, so it isn't affected. Any consumer who stores Note, Chord or Phrase in their own settings JSON gets unreadable output that can't be loaded back.
Add a JsonConverter<Note> (via [JsonConverter]) that writes the key as a string and reads it back through the normalizing Note(string) constructor. Alternatively, register a SemanticString converter for NoteName. If direct serialization isn't meant to be supported, remove [JsonConstructor] so the type stops advertising it.
Acceptance:Note round-trips through JsonSerializer as {"Key":"CTRL"}, and lowercase or alias input deserializes to the canonical note.
Priority: Medium. Consumers who serialize Note, Chord or Phrase directly get output they cannot load back. The library's own persistence goes through string DTOs and is unaffected.
Area / suggested owner:Models/MusicalTypes.cs JSON support: add a JsonConverter<Note>, or drop [JsonConstructor] (maintainer: @matt-edmondson)
Activity
matt-edmondson commentedon Sep 26, 2026
Triage
Note,ChordorPhrasedirectly get output they cannot load back. The library's own persistence goes through string DTOs and is unaffected.Models/MusicalTypes.csJSON support: add aJsonConverter<Note>, or drop[JsonConstructor](maintainer: @matt-edmondson)[JsonConstructor] Note(NoteName)overload; a converter that routes through the normalizingNote(string)constructor fixes both. Delegate profile/command JSON persistence to ktsu.AppDataStorage #93 (delegating persistence to AppDataStorage) is adjacent but separate.Generated by Claude Code