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

217
Views
How to get jsonData when objects inside have different name?

I am receiving data from backend to show in a table, but there's something i don't how to manage objects inside json are from 0 to 4 but there are more data with different name just like img1 I don't have any problems displaying data from 0-4 but can not get data from version1-4 . Number of version is limited to number of objects in comming, I mean if i have 0-9 objects i will have version1.....version-10

 const responseText = await response.json();
    console.log(responseText);
    if (!responseText.Err) {
      for (let i in responseText) {
        if (responseText.hasOwnProperty(i)) {
          if (responseText[i].id) {
            const entrega = responseText[i].versionData;
            const comment = responseText[i].comentario;
            const commnetTruncated = comment.substring(0, 40);
            const date = responseText[i].fecha;
            console.log(responseText.version1);
            newTableBody += `<tr> <td>${entrega}</td><td id='v${entrega}'></td><td>${commnetTruncated}...</td><td>${date}</td> </tr>`;
          }
        }
        
      }
      tableBody.innerHTML = newTableBody;
    }

Tried using responseText.version${i+1} but its not allowed

Appreciate your help!

json from backend

about 4 years ago · Juan Pablo Isaza
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!