fixed for loop running through json data