JSON Schema can be used to validate Hjson documents. Hjson, a user interface for JSON (Hjson) adds new language features and relaxes syntax restrictions aiming to make information entry easier and less error prone. Hjson only intends to be an intermediary between humans and JSON, as such the clear schema language is JSON Schema.

JSON

[
    {
        "id": 2,
        "name": "An ice sculpture",
        "price": 12.5,
        "tags": [
            "cold",
            "ice"
        ],
        "dimensions": {
            "length": 7,
            "width": 12,
            "height": 9.5
        },
        "warehouseLocation": {
            "latitude": -78.75,
            "longitude": 20.4
        }
    },
    {
        "id": 3,
        "name": "A blue mouse",
        "price": 25.5,
        "dimensions": {
            "length": 3.1,
            "width": 1,
            "height": 1
        },
        "warehouseLocation": {
            "latitude": 54.4,
            "longitude": -32.7
        }
    }
]

Hjson

[
  {
    id: 2
    name: An ice sculpture
    price: 12.5
    tags:
    [
      cold
      ice
    ]
    dimensions:
    {
      length: 7
      width: 12
      height: 9.5
    }
    warehouseLocation:
    {
      latitude: -78.75
      longitude: 20.4
    }
  }
  {
    id: 3
    name: A blue mouse
    price: 25.5
    dimensions:
    {
      length: 3.1
      width: 1
      height: 1
    }
    warehouseLocation:
    {
      latitude: 54.4
      longitude: -32.7
    }
  }
]

Example JSON from the JSON Schema website.

Editor Support

No editors supporting JSON Schema validation of Hjson documents are known.

Tools and Libraries

  • Polyglottal JSON Schema Validator - Written in JavaScript. Released under the MIT license.
    • Polyglottal JSON Schema Validator (pajv) is a command line utility that can be used to validate data in numerous formats against a JSON Schema.

Alternatives

No other schema definition formats are known to target Hjson.