Practice · 2 of 3
The API That Sends Numbers as Strings
CHALLENGE
Difficulty: intermediate+25 XP
LegacyApi sends {"count": "5"}. DeserializePayload must accept both {"count": 5} and {"count": "5"} into Payload.Count (int) via a custom JsonConverter<int>. Must also REJECT {"count": true}.
``csharp
public sealed class Payload { public int Count { get; set; } }
static Solution.Payload? DeserializePayload(string json);
``
Press Submit to check your solution.
Back to lesson: Practice: JSON Practice: Options, Converters, Boundaries