Hi All,
I am having a json like following
["G6863","2010368363","201030821","NewData","Latest"]
I want to Convert the above JSON to c# classs of fallowng
public Class classified{
public string GId{set;get}
public string UID{set;get}
public string UDATE{set;get}
public string MESSAGE{set;get}
public string UPDATEREASON{set;get}
}
i want to be it generic as i need to write it to many files
What I have tried:
so i tried the following
var SerializedText=["G6863","2010368363","201030821","NewData","Latest"]
JsonConvert.DeserializeObject(SerializedText, typeof(classified)) as classified
but it is throwing fallowing error
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'classified' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<t> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.