Always replace LF with \n and strip CR, as JSON does not support control characters