The leads you are generating returns \n but the json only accepts \\n, that is why you have invalid json error