@PFJ, Welcome to Microsoft Q&A, you could try to add a second property to your class.
Here is a code example you could refer to.
internal class Program
{
static void Main(string[] args)
{
string json1 = @"{""Value1"":""test1"",""Desc"":""This is d1""}";
string json2 = @"{""Value2"":""test2"",""Desc"":""This is d2""}";
var obj1 = JsonSerializer.Deserialize<Test>(json1);
var obj2= JsonSerializer.Deserialize<Test>(json2);
Console.WriteLine(obj1.Value1);
Console.WriteLine(obj2.Value1);
}
}
public class Test
{
[JsonPropertyName("Value1")]
public string Value1 { get; set; }
[JsonPropertyName("Value2")]
public string Value2 { set { Value1 = value; } }
public string Desc { get; set; }
}
As the result is shown, we also could output the Value2's value:
Hope my solution could be helpful for you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.