I have found this popular JSON editor that can be used in web applications.
This is the code that I have used in Anvil (according to the JSONEditor instructions):
// in native libraries
<link href="jsoneditor/dist/jsoneditor.min.css" rel="stylesheet" type="text/css">
<script src="jsoneditor/dist/jsoneditor.min.js"></script>
// in a custom HTML component
<div id="jsoneditor" style="width: 400px; height: 400px;"></div>
<script>
// create the editor
var container = document.getElementById("jsoneditor");
var editor = new JSONEditor(container);
</script>
Unfortunately, I get the JSONEditor is not defined
error. I believe this may have something to do with libraries not loading in the order that I expect, as detailed in this post. I have tried the solution in that post but I still cannot manage to load the library (the console tells me that it is not loaded AFAICT).
This is a simple clone that demonstrates the issue.
https://anvil.works/build#clone:ATZMZJIMJMMG4I2J=OJ6EHDFEGYZTC4CPITW4CZ2M
Does anyone have some insight into what I am doing wrong?