score:2

Accepted answer

Below check each property and return you not empty properties

jObject.Children().AsEnumerable().ToList()
.Count(t=> !string.IsNullOrWhiteSpace( t.Values().ToList()[0].ToString()))

Note : this code is based on the object structure provided in question.

score:0

You could use int counter = jObject.Children().Count(c => string.IsNullOrEmpty(((JProperty)c).Value.ToString()));, but see for yourself if that is more readable.


Related Articles