trimming debug json to make parsing more robust