New lines are removed from functions only when calling JSON.stringify with this jsonFilter function. All the other new lines are preserved.