formatting and remove of json infinite loop