skip to Main Content

Asp.net – Deserialize an object that can have string or int from JSON format

How do I deserialize an object from JSON format with valid data using JsonConvert.DeserializeObject(useCaseData)? I tried it with JsonConvert.DeserializeObject<Dictionary<string, string>>(useCaseData) But I get this error : Newtonsoft.Json.JsonSerializationException: 'Error converting value 1 to type 'System.Collections.Generic.Dictionary`2[System.String,System.String]'. Path '', line 1, position 1.…

VIEW QUESTION

C# deserialize KeyValuePair from JSON

This is the absolute simplest version of this question (a subset of it). using System; using System.Collections.Generic; using System.Text.Json; public class Program { public class Subscription { public bool HasRead { get; set; } = true; public string TimeStamp {…

VIEW QUESTION
Back To Top
Search