diff --git a/senpy/static/js/main.js b/senpy/static/js/main.js index e676504..330dc95 100644 --- a/senpy/static/js/main.js +++ b/senpy/static/js/main.js @@ -159,15 +159,22 @@ function load_JSON(){ } } - var response = JSON.parse($.ajax({type: "GET", url: url , async: false}).responseText); + var response = $.ajax({type: "GET", url: url , async: false}).responseText; + rawcontainer.innerHTML = replaceURLWithHTMLLinks(response) + + document.getElementById("input_request").innerHTML = ""+url+"" + document.getElementById("results-div").style.display = 'block'; + try { + response = JSON.parse(response); var options = { mode: 'view' }; var editor = new JSONEditor(container, options, response); editor.expandAll(); - rawcontainer.innerHTML = replaceURLWithHTMLLinks(JSON.stringify(response, undefined, 2)) - document.getElementById("input_request").innerHTML = ""+url+"" - document.getElementById("results-div").style.display = 'block'; + } + catch(err){ + console.log("Error decoding JSON (got turtle?)"); + } }