I am calling in JSON that returns like
Here is an actual part of the JSON file. There is more to it than this but I am just trying to show how I can get nested values.
{
  player: {
    id: 277013255,
    game: "bf4",
    plat: "pc",
    name: "f1ss1on",
    tag: "MCG",
    dateCheck: 1524851054474,
    dateUpdate: 1524849279114,
    dateCreate: 1385342286868,
    dateStreak: 1524849279114,
    lastDay: "20160222",
    country: "",
    countryName: null,
    rank: {
      nr: 33,
      imgLarge: "bf4/ranks/r33.png",
      img: "r33",
      name: "Master Sergeant III",
      needed: 1280000,
      next: {
        nr: 34,
        imgLarge: "bf4/ranks/r34.png",
        img: "r34",
        name: "Master Sergeant IV",
        needed: 1345000,
        curr: 1317090,
        relNeeded: 65000,
        relCurr: 37090,
        relProg: 57.06153846153846
      }
    },
My Code is:
$(document).ready(function() {
  "use strict";
  var html = '';
  $("button").click(function() {
    $.getJSON("https://api.bf4stats.com/api/playerInfo?plat=pc&name=f1ss1on&output=json", function(result) {
      $.each(result, function(i, entry) {
        html += '<ul>';
        html += '<li class="name col-5">' + entry.name + '</li>';
        html += '<li class="date col-3">' + entry.tag + '</li>';
        html += '<li class="assigned col-4">' + entry.rank + '</li>';
        html += '</ul>';
      });
    }
    $('div').html(html);
  });
});
The expected return should be
- f1ss1on
- MCG
- 33
But instead I get this in return:
- f1ss1on
- MCG
- [object Object] 
- undefined 
- undefined
- 33
How can I properly call nested JSON objects onto the correct element?
I have tried doing:
entry.rank.nr
but this returns "Uncaught TypeError: Cannot read property 'nr' of undefined"
 
    