S
S
Semyon Kataparov2016-05-03 17:13:41
JavaScript
Semyon Kataparov, 2016-05-03 17:13:41

I can't display the result of parsing the JSON result. How to decide?

I can't display the result of parsing the JSON result. How to decide?
The code:

steamUserInventory('featixy').then(data => {
  console.log(data);
});

Outputs: pastebin.com/PvSFsNv3
And if you already display the result that I processed, it does not display anything, the code:
steamUserInventory('featixy').then(data => {
  var obj = JSON.parse(data);
  console.log(obj.id);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-05-03
@truexizt1

you have an array, not an object.
try

steamUserInventory('featixy').then(data => {
    for(i in data) {
        console.log(data[i].id);
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question