diff --git a/files/cert2json.py b/files/cert2json.py
index 4ccaed8c803f956803760dc119a7ea518077a28d..2c72c9a42137b1c26cb6f844a75c0342b4e294ac 100755
--- a/files/cert2json.py
+++ b/files/cert2json.py
@@ -44,15 +44,13 @@ with open(YAML_FILE, "w") as yaml_out:
     yaml_out.write("{} Certificates:\n".format(PROVIDER_STRING))
     for txt_line in DECODED_OUTPUT:
         if "Certificate Name:" in txt_line:
-            txt_line = re.sub('.*Certificate Name: ', '  ', txt_line)
-            txt_line_out = re.sub('\n', ':\n', txt_line)
+            txt_line_out = re.sub('.*Certificate Name: ', '  ', txt_line) + ":"
         elif "Serial Number: " in txt_line:
             txt_line_out = re.sub('.*Serial Number: ', '    Serial Number: ', txt_line)
         elif "Domains: " in txt_line:
             txt_line_out = re.sub('.*Domains: ', '    Domains: ', txt_line)
         elif "Expiry Date: " in txt_line:
-            txt_line = re.sub('.*Expiry Date: ', '    Expiry Date: "', txt_line)
-            txt_line_out = re.sub('\n', '"\n', txt_line)
+            txt_line_out = re.sub('.*Expiry Date: ', '    Expiry Date: "', txt_line) + '"'
         elif "Certificate Path: " in txt_line:
             txt_line_out = re.sub('.*Certificate Path: ', '    Certificate Path: ', txt_line)
         elif "Private Key Path: " in txt_line: