fixed json; removed a loop