In MyClass
I have property JsonArrayString
. It is array of json objects.
What is best way to convert this string into array of MyJsonObject
class in ASP.NET MVC Core application.
P.S. I can change structure of json string.
class MyClass {
public string JsonArrayString => "[{"Value": "1", "Name": "One"}, ...]";
public List<MyJsonObject> JsonArray => ...
}
public class MyJsonObject {
string Value { get; set; }
string Name { get; set; }
}
Result:
// First element of JsonArray => MyJsonObject() { Value = "1", "Name" = "One"};