Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Calling all directories in JSON

I want to change below values ../data/data_0/ into a general syntax so that I don't have to specify those directories individually as I have to give 500 directories. I know some other languages just use * i.e. ../data/data_*/ but I guess this is not the case in JSON.

"training": {
  "training_data": {
    "systems": ["../data/data_0/", "../data/data_1/", "../data/data_2/"],
    "batch_size": "auto",
    "_comment": "that's all"
  },
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

// suppose you have many directries i.e 500

const dirs = [...Array(500).keys()].map((dir) => `./data/data_${dir}`);

const result = {
  training: {
    training_data: {
      systems: dirs,
      batch_size: "auto",
      _comment: "that's all"
    }
  }
};

console.log(result);
about 4 years ago · Juan Pablo Isaza Report

0

Use a for loop to create an array with all 500 directories, then put it into the object.

let systems = [];
for (let i = 0; i < 500; i++) {
    systems.push(`../data/data_${i}`);
}

let object = {
    "training" : {
        "training_data": {
        "systems":      systems,
        "batch_size":   "auto",
        "_comment":     "that's all"
    },
    ...
};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!