I get the JSON output on the UI using the below function
$("#idvar").click(function(){
var d1 = document.getElementById("dText");
var d2 = document.getElementById("dJson");
var mytext = d1.textContent;
alert(mytext);
$.post(
url,
{doc: mytext},
function(data) {
console.log(Object.keys(data).length);
d2.textContent = data;
}
);
});
where d1 is the displaying the uploaded input document, d2 for the output generated from processing the document on a model. Currently, I am getting json format. I tried to implement the codes in these posts (Parsing JSON objects for HTML table, Convert json data to a html table), but I get [object, Object] in the text area. Is there a way to convert the json to table.
In the URL text area i get
[{"tag":"a1","relevance":0.5},
{"tag":"a2","relevance":0.3},
{"tag":"c3","relevance":0.2},{"tag":"d3,
...
Instead, I was hoping to get
d2.textContent = data;ford2.textContent = JSON.stringify(data);<li>a1 (0.2)</li><li> a2 (0.3)</li>used$('#d2').html(json2html.transform(data, transform));wherevar transform = {'<>':'li','html':'${tag} (${relevance})'};Is it possible to remove those tags from the output