updated to count array elements for the JSON record set