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

185
Views
¿Cómo puedo acceder y procesar matrices anidadas en JSON para importar en Excel?

Aquí están los datos JSON: -

 "data": [
 {
 "character_id": "5785304882",
 "id": 289222,
 "login_status": {
 "created": "2022-09-21T19:52:04.394",
 "status": "Started Competition"
 },
 "name": "user_01",
 "team": "DA ATRAX ESPORTS"
 }

Aquí está el código JS: -

 gacworksheet.columns = [
 { header: "User Name", key: "name", width: 10 },
 { header: "Team Name", key: "team", width: 10 },
 { header: "Character ID", key: "character_id", width: 10 },
 { header: "Login Time", key: "loginTime", width: 10 },
 { header: "Login Status", key: "loginStatus", width: 10 },
];

var json = JSON.parse(result);
var userData = json['data']; 
userData.forEach(user => {
 for (var i = 0; i < userData.length; i++) {
 var loginTime = userData[i].login_status.created;
 var loginStatus = userData[i].login_status.status;
 }
 gacworksheet.addRow(user);
});
let gacdata = gacworksheet.getSheetValues();
gacMData = gacdata.map(function(r){
 return [r[1],r[2],r[3],r[4],r[5]];
});
console.log(gacMData);

Cuando console.log registro los datos, los datos que están dentro de la matriz no están undefined . ¿Cómo establecer el valor de la matriz en una clave?

Resultado de console.log(gacMData);

 [
 'User Name',
 'Team Name',
 'Character ID',
 'Login Time',
 'Login Status'
 ],
 [ 'user_01', 'DA ATRAX ESPORTS', '5785304882', undefined, undefined ],
 [ 'user_02', 'DA ATRAX ESPORTS', '5670142641', undefined, undefined ],
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

userData.forEach(user => {
 let newUser = {...user}
 newUser.loginTime = user.login_status.created;
 newUser.loginStatus = user.login_status.status
 gacworksheet.addRow(newUser);
 });
almost 4 years ago · Santiago Trujillo 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!