I am having the JSON object which is stored in to in to the Variable. The JSON looks like
{
"data":
[
{"SNumber":"05",
"LName":"TyJ",
"LNameMarkup":"18/TyJ"
}]}
I created the Model class for the JSON like
namespace SetName.Models
{
public class SNameDTO
{
public class Datum
{
public string SNumber { get; set; }
public string LName { get; set; }
public string LNameMarkup { get; set; }
}
public class RootObject
{
public List<Datum> data { get; set; }
}
}
}
Now I want to deserialize this JSON I can get the LName from it
var retSName = GetSName(StockNumber); //stores the JSON shown above
I replaced the above code with
SNameDTO.RootObject retSName = GetSName(StockNumber);
It throws error like
Cannot implicitly convert type 'string' to 'SetName.Models.SNameDTO.RootObject'
I am trying to use the Model Class instead of the dynamic objects.