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

132
Views
Analizar resultados JSON en múltiples columnas HTML usando JQuery

Estoy trabajando con una API y me gustaría extraer los resultados de la API en columnas de una tabla HTML con un número X de filas. Este es un problema con el bucle JQuery, no sé cómo hacerlo. ¡Gracias de antemano!

 /////JSON SAMPLE///// { "123SC": [{ "name": "First", "Custnumber": "123SC" }, { "name": "Fourth", "Custnumber": "123SC" } ], "67BC": [{ "name": "Second", "Custnumber": "67BC" }], "99ABC": [{ "name": "Third", "Custnumber": "99ABC" }] } ///////// END JSON ////// 

 <table style="width:100%" border="2"> <tr> <td>First</td> <td>Forth</td> <td>Second</td> <td>Third</td> </tr> <tr> <td>123SC</td> <td>123SC</td> <td>67BC</td> <td>99ABC</td> </tr> </table>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto:

 let json = { "123SC": [{ "name": "First", "Custnumber": "123SC" }, { "name": "Fourth", "Custnumber": "123SC" } ], "67BC": [{ "name": "Second", "Custnumber": "67BC" }], "99ABC": [{ "name": "Third", "Custnumber": "99ABC" }] }; let arrays = []; for (const i in json) arrays = [...arrays, ...json[i]]; let names = '<tr>'; let Custnumber = '<tr>'; for (let i = 0; i < arrays.length; i++) { names += `<td>${arrays[i].name}</td>`; Custnumber += `<td>${arrays[i].Custnumber}</td>`; } names += '</tr>'; Custnumber += '</tr>'; let html = `<table style="width:100%" border="2">${names + Custnumber}</table>`; document.write(html);

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!