C#C
C#3y ago
Conner

❔ Cannot deserialize System.Drawing.Color from JSON

It seems like the System.Text.Json library is not able to deserialize a Color from a JSON string it serialized before.

Code I used for testing:
public static void TestSerialisation()
{
    Color toJson = Color.FromArgb(0xFF, 0xF, 0x36);
    string inJson = JsonSerializer.Serialize(toJson);
    Color fromJson = JsonSerializer.Deserialize<Color>(inJson);
}
05.09.2023_16h.37m.png
Was this page helpful?