Quantcast
Channel: Parse JSON feed to HTML with jQuery - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Parse JSON feed to HTML with jQuery

$
0
0

I am trying to parse the following JSON feed into HTML, but not getting any results.

{  @name: "App name",  license: [    {      @name: "Apache License 2.0",      component: [        {          name: "Product 1",          url: "http://www.url.com"        }, {          name: "Product 2",          url: "http://www.url.com"        }, {          name: "Product 3",          url: "http://www.url.com"        }      ],      licensetext: " license text here"    }  ],  isProjectComplete: "true"}

With this jQuery:

$.getJSON("https://json-feed-url.json", function (data) {  var jsondata = json;  var output = "<ul>";  for (var i in jsondata.events) {    output += "<li>"+ jsondata.component[i].name +""+ jsondata.component[i].url +"--"+ jsondata.license[i].licensetext+"</li>";  }  output += "</ul>";  document.getElementById("content").innerHTML = output;});

To this div

<div id="content"></div>

Not sure why its not parsing correctly. Here's a jsFiddle.


Viewing all articles
Browse latest Browse all 3

Trending Articles