1

I have a JSON file with multiple 'rows', how can i just show the rows i need?

In my case, i need to show the Name and Score, also, i need the IP to show up when i click a user's name, and do not show any UselessData rows.

(I do not require code for all that, i just need to get the general idea)

JSON File

{
    "records": [
    {
      "name": "AAAA",
      "score": 100,
      "IP" : "0.0.0.0",
      "UselessData" : "Whatever"
    },
    {
      "name": "BBBB",
      "score": 50,
      "IP" : "1.1.1.1",
      "UselessData" : "Whatever"
    },
    [...]
    ],
}

I've been searching through de Documentation and a bit of the Source Code, but did not see anything like it, i may have just skipped it though, because it seems like a basic setting, but i just cannot figure it out.

DSN94
  • 304
  • 4
  • 16
  • Not an answer you probably hope for but I couldn't get this "basic setting" to work a while ago. I switched to [DataTables](https://datatables.net/). So just a comment not an answer. Good luck though – KRONWALLED Jun 11 '16 at 21:55
  • Thank you for letting me know though, @KRONWALLED , i'll give it a look. – DSN94 Jun 11 '16 at 22:12

1 Answers1

0

If I understand correctly, you're just needing an array of object with three properties. I think, what you can do is just to map through your records and return object with the data you just need. Something like this

x.records.map(function(record) {
  return {name: record.name, score: record.score, IP: record.IP};
});
Nafiul Islam
  • 1,220
  • 8
  • 20