Unable to convert list property to Newtonsoft.Json.Linq.JArray
GhayourAli opened this issue · 1 comments
Hi, I am trying to convert a list of objects to Newtonsoft.Json.Linq.JArray as follows
Newtonsoft.Json.Linq.JArray
details = Model.Details != null ? (Newtonsoft.Json.Linq.JArray)Model.Details : null;`
But when I call engine.CompileRenderStringAsync, it gives the following error message Cannot convert type 'System.Collections.Generic.List<RazorLite.Detail>' to 'Newtonsoft.Json.Linq.JArray'
I also tried iteration through the list rather than converting it to Newtonsoft JArray, but it also won't let me iterate over it.
Any help with this?
This looks like a beginning programming question. According to the JArray api https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JArray.htm , RazorLite.Detail needs to be a JToken. https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JToken.htm
Closing and locking. I'm not really here to answer beginning programming questions.