const fs = require('fs');
const flat = require('flat');

function fixParagraphStructure(originalJSONPath, translatedJSONPath) {
  const originalJSONFile = fs.readFileSync(originalJSONPath);
  const originalJSON = flat.flatten(JSON.parse(originalJSONFile));
  const translJSONFile = fs.readFileSync(translatedJSONPath);
  const translJSON = flat.flatten(JSON.parse(translJSONFile));
  const newTranslatedObj = {};

  for (var key in originalJSON) {
    if (key in translJSON) {
      newTranslatedObj[key] = translJSON[key];
    } else {
      let root = key.slice(0, key.length - 2);
      if (root.endsWith('description') && root + '.0' in translJSON) {
        newTranslatedObj[key] = '';
      } else {
        newTranslatedObj[key] = originalJSON[key];
      }
    }
  }

  fs.writeFileSync(
    translatedJSONPath,
    JSON.stringify(flat.unflatten(newTranslatedObj), undefined, 2)
  );
}

@@ -239,35 +239,61 @@
 riginalJSONFile)
+, %7B%0A    delimiter: '/'%0A  %7D
 );%0A
-
   const translJS
@@ -398,16 +398,42 @@
 SONFile)
+, %7B%0A    delimiter: '/'%0A  %7D
 );%0A  con
@@ -679,17 +679,17 @@
 root + '
-.
+/
 0' in tr
@@ -884,16 +884,23 @@
 ringify(
+%0A      
 flat.unf
@@ -926,23 +926,60 @@
 dObj
-), undefined, 2
+, %7B delimiter: '/' %7D),%0A      undefined,%0A      2%0A    
 )%0A  

Change delimiter in flatten function