Added json format checking before determining the count.