How to I display fetched JSON data in table TD

Hi all I’d need the kind assistance on displaying fetched JSON data in table TD. Is there a way to transverse the TR or TD to display the data using Javascript?
The table looks shown below. I would need to display the name of a customer in the second TD of each TR.

    <td>Jill Smith</td>
    <td>Amanada Lee</td>

JS Code

window.onload = function(){ 
    .then(function(response) {
        return response.json();
        nameData = data;

    .catch(function(error) {


I understand that I can add the class selector to the td but would like to know if there are other ways apart from this?

I have looked thru many threads on populating JSON into table.

Any help is appreciated. Thank you.

You would want to get each 2nd td into an array-like structure, so that you can map over each customer name and apply it to the td structure.

var nameData = [
  "Paul Wilkins",
  "Jane Smith"
var tableNames = document.querySelectorAll("table td:nth-child(2)"); (name, index) {
  tableNames[index].innerText = name;

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.