Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE HTML>
<html>
<head>
  <title>JSONEditor | template + enums</title>
  <link href="https://unpkg.com/jsoneditor@5.32.4/dist/jsoneditor.css" rel="stylesheet" type="text/css">
  <script src="https://unpkg.com/jsoneditor@5.32.4/dist/jsoneditor.js"></script>
  <style type="text/css">
    #jsoneditor {
      width: 500px;
      height: 700px;
      background: white;
    }
    
    p {
      width: 500px;
      font-family: sans;
    }
  </style>
</head>
<body>
  <div id="jsoneditor"></div>
  <script>
    var schema = {
      "title": "Example Schema",
      "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "enum": ["a", "b"]
          },
          "testObj": {
            "type": "object",
            "additionalProperties": {
                "type": "string",
                "enum": ["a", "b"]
            },
          }
        },
        "required": ["firstName"]
    };
    var json = 
      {
        firstName: 'a',
        testObj: {},
      };
    
    var options = {
      schema: schema
    };
    // create the editor
    var container = document.getElementById('jsoneditor');
    var editor = new JSONEditor(container, options, json);
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers