array-nested-arrays.html 815 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <script src="../../dist/jsoneditor.js"></script>
  6. </head>
  7. <body>
  8. <textarea class="debug" cols="30" rows="10"></textarea>
  9. <button class='get-value'>Get Value</button>
  10. <div class='container'></div>
  11. <script>
  12. var container = document.querySelector('.container');
  13. var debug = document.querySelector('.debug');
  14. var schema = {
  15. "type": "array",
  16. "title": "Strings",
  17. "items": {
  18. "title": "Array",
  19. "type": "array",
  20. "items": {
  21. "title": "String",
  22. "type": "string"
  23. }
  24. }
  25. };
  26. var editor = new JSONEditor(container, {
  27. schema: schema
  28. });
  29. document.querySelector('.get-value').addEventListener('click', function () {
  30. debug.value = JSON.stringify(editor.getValue());
  31. });
  32. </script>
  33. </body>
  34. </html>