In that case, you should count the amount of records in the array, rather than depend on the format of the keys of each array member.