fixed index out of range error in json view