Updated JSONResponse to check the correct array is not empty.