const fs = require('fs'); const f = fs.readFileSync('quotes.txt', 'utf8'); f .split('%') .map(s => s.trim()) .map(q => ({ "title": { "text": "Random #evidence quote", "underlined": true, "color": "gold" }, "tip": { "text": q } })) .map(json => JSON.stringify(json)) .forEach((content, i) => { fs.writeFileSync(`quote-${i}.json`, content); });