I have object value
{[
"Temp",
"Humidity"
]}
I want to Convert it to list string I try
var res= (List<string>)value ;
var res1= value.OfType <List<string>>().ToList();
but it return null
I have object value
{[
"Temp",
"Humidity"
]}
I want to Convert it to list string I try
var res= (List<string>)value ;
var res1= value.OfType <List<string>>().ToList();
but it return null
(Would be mess in a comment). If that is coming in as a string, then you could use Newtonsoft from nuget to convert. ie:
var str = @"{[
""Temp"",
""Humidity""
]} ";
var json = str.Trim(new char[] { ' ', '{', '}'});
var strlist = JsonConvert.DeserializeObject<List<string>>(json);
EDIT: Along the comments, you say it is a Newtonsoft.Json.Linq.JArray, then this would do:
var lstString = JsonConvert.DeserializeObject<List<string>>(myObject.ToString());