Q:

Converting HTML list from json files

I have a problem with my code when listing countries from json file:
My HTML
<div id="country">country</div>

My JS Code
$.getJSON( "country.js", function( data ) {
  var items = [];
  $.each( data, function( key, val ) {
    items.push( "<li id='" + key + "'>" + val + "</li>" );
  });

  $( "<ul/>", {
    html: items.join( "" )
  }).appendTo( "#country" );
});

Fiddle link

A:

Your json source is wrong.

remove var countryList = 
Find code: 'TF'  and change it to "code": "TF"
You accessed wrong variable.
items.push( "<li id='" + val.countryCode + "'>" + val.countrName + "</li>" );

