AWS Firehose newline Character

Try decoding the record.data add a new line then encode it again as base 64.

This is python but the idea is the same

for record in event['records']:
    payload = base64.b64decode(record['data'])
    # Do custom processing on the payload here
    payload = payload + '\n'
    output_record = {
        'recordId': record['recordId'],
        'result': 'Ok',
        'data': base64.b64encode(json.dumps(payload))
    }
    output.append(output_record)
return {'records': output}

From the comment of @Matt Westlake:

For those looking for the node answer, it's

const data = JSON.parse(new Buffer.from(record.data,'base64').toString('utf8'));

and

new Buffer.from(JSON.stringify(data) + '\n').toString('base64')