$.getJSON('https://api.cdnjs.com/libraries/jquery', function(data){
var array = [];
$.each(data, function(key, val){
array.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', {
'class': 'jqlist',
html: array.join('')
}).appendTo('body');
});
$.getJSON('https://api.cdnjs.com/libraries/jquery', function(data) {
$('body').append(`<pre>${JSON.stringify(data, null, 2)}</pre>`);
});
const toHTML = val =>
val instanceof Object
? `<ul>${Object.values(val).map(n => `
<li>${toHTML(n)}</li>`).join('')}
</ul>`
: val;
$.getJSON('https://api.cdnjs.com/libraries/jquery', function(data) {
$('body').append(toHTML(data));
});