Skip to content

Generate sample JSON

Michael Martin-Smucker edited this page Jun 7, 2019 · 1 revision

We have a very large JSON array in ./test/utils, used to ensure stack safety. For future reference, this file was generated using this script (run from the project root):

/* gen.js (run as `node gen.js`) */
const fs = require("fs");

var arr = [];

for (let i = 0; i < 20000; i++) {
  arr.push({
    x: Math.floor(Math.random() * 100),
    y: Math.floor(Math.random() * 10),
  });
}

fs.writeFileSync("./test/utils/BigJson.json", JSON.stringify(arr));
Clone this wiki locally