© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
105 replies
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);
}
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

JSON Deserialize
C#CC# / help
2y ago
JSON deserialize
C#CC# / help
2y ago
How to Deserialize dynamic types from json
C#CC# / help
4mo ago
✅ JSON Deserialize Derived Class
C#CC# / help
2y ago