'Problem with running a script to extract and convert a JSON object

<script>
  $(document).ready(function() {
    var chains = ["arb", "astar", "aurora", "avax", "boba", "bsc", "btt", "celo", "cro", "eth", "ftm", "fuse", "heco", "hmy", "iotx", "kcc", "klay", "matic", "metis", "mobm", "movr", "okt", "op", "palm", "rsk", "sbch", "sdn", "sgb", "wan", "xdai"];
    var data = {};
    var getData = [];
    $.each(chains, function(index, value) {
      var chainName = value;
      var output = Object.keys(data.chainName.token_dict).map((k, v) => data.chainName.token_dict[k]);
      var getJSON = JSON.stringify(output);
      var json = '{"chain":"' + value + '","token_dict": [' + getJSON + ']}';
      getData.push(getJSON);
    });
    console.log(getData);
  });
</script>

There is a script that iterates through the array and extracts data from the JSON object, the problem is that for some reason the brute force script does not extract the value parameter (which refers to chains) and returns an error. What could be the matter?

the data variable contains data received by api:



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source