I have applied GroupBy on columns of JArray and looping through all grouped list and from each group trying to get rows where "sectionGroup" column value is null. But when I try with Linq, it’s returning Boolean list. I have never worked with JArray before.
public Task<JArray> JLogData(JArray jArray)
{
var groupData = jArray.GroupBy(g => new { modelName = g["modelName"], nlpModelVersion = g["nlpModelVersion"], docId = g["docId"] });
foreach (var item in groupData)
{
// This is returning Boolean list. and I am trying go get list
var itemSectionGroup = item.Select(x => x["sectionGroup"] == null);
var itemSectionGroupNull = item.Select(x => x["sectionGroup"] != null);
}
}
What can I try next?
2
Answers
In order to get the rows where the
sectionGroup
column value is null, you should use theWhere
method instead ofSelect
, and only then filter the elements.