JSON templates

A service often needs to describe the form that input objects are allowed to take. This includes which properties the object can have, and what the type of each property should be.

One standard way to describe a simple object is using a HTML form. However, as HTML forms don't easily handle nested objects, JSON can be preferable for more complex objects.

JSON Schema

The JSON Schema for Citation Style Language describes the object that CSL expects to process.

JSON template

A JSON template has the same properties as a real object, but with empty values.

Zotero's API uses a JSON template to describe the properties of an object, and their types:

Query by template

The Metaweb Query Language (MQL) goes even further, using JSON templates as the basis for querying.

The properties that have values are used as the query and the properties that are empty will be filled in as the response.

  "type": "/music/album",
  "name": "Synchronicity",
  "artist": "The Police",
  "track": []
  "type": "/music/album",
  "name": "Synchronicity",
  "artist": "The Police",
  "track": [
    "Synchronicity II",
    "Every Breath You Take",
    "King of Pain",
    "Wrapped Around Your Finger",
    "Tea in the Sahara",
    "Walking in Your Footsteps",
    "Miss Gradenko",
    "Murder by Numbers",
    "O My God",
    "Synchronicity I",