Sha256: 32352fdb091c0605283f918e71a08d2062a858306fa246efefce3a57512c0929

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

<!DOCTYPE HTML>
<html>
<head>
  <title>JSONEditor | Basic usage</title>

  <link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
  <script src="../dist/jsoneditor.js"></script>

  <style type="text/css">
    #jsoneditor {
      width: 500px;
      height: 500px;
    }
  </style>
</head>
<body>
<p>
  <button id="setJSON">Set JSON</button>
  <button id="getJSON">Get JSON</button>
</p>
<div id="jsoneditor"></div>

<script>
  // create the editor
  var container = document.getElementById('jsoneditor');
  var options = {};
  var editor = new JSONEditor(container, options);

  // set json
  document.getElementById('setJSON').onclick = function () {
    var json = {
      'array': [1, 2, 3],
      'boolean': true,
      'null': null,
      'number': 123,
      'object': {'a': 'b', 'c': 'd'},
      'string': 'Hello World'
    };
    editor.set(json);
  };

  // get json
  document.getElementById('getJSON').onclick = function () {
    var json = editor.get();
    alert(JSON.stringify(json, null, 2));
  };
</script>
</body>
</html>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
statixite-1.0.2 vendor/assets/bower_components/jsoneditor/examples/01_basic_usage.html
statixite-1.0.1 vendor/assets/bower_components/jsoneditor/examples/01_basic_usage.html
statixite-1.0.0 vendor/assets/bower_components/jsoneditor/examples/01_basic_usage.html