Field types

JSON schema

Field type json_schema. Any JSON, following a JSON Schema you write yourself. The schema determines the input form, the range of values and the validation; the editor writes the value back unchanged. Data entry from the cataloguer’s side is described under JSON schema .

JSON schema field Restaurierungsprotokoll (conservation log) in Moliri: the table generated from the schema with Datum (date), Maßnahme (treatment) and Bearbeitung (conservator), two entries

Parameters

KeyValuesField type defaultEffect
schemaJSON Schemaa table with one number columnStructure and form of the field

The editor is json-editor ; its documentation applies to everything the schema can do.

JSON
{
  "schema": {
    "type": "array",
    "format": "table",
    "title": " ",
    "items": {
      "type": "object",
      "properties": {
        "height": { "type": "number", "title": "Höhe" },
        "width":  { "type": "number", "title": "Breite" }
      }
    }
  }
}

How it relates to the field type JSON

Both store JSON and exist side by side, with different value models:

jsonjson_schema
Value modelList of entries (label and subfields)Any JSON following the schema
Configurationview, labels, fields, maxa schema
Output formatteryesno
Binding to standardsyes, as a repeatable sourceno
Excel importDocument, column rule, value under a labelonly a complete document

For new fields, JSON is usually the better choice. json_schema remains for structures that really have to be free. When the field types were split, all existing JSON fields were assigned to this field type without touching their values. That is why an older field sits here even if its structure is a simple table.

Switching an older field to JSON

Only the configuration is translated; the data stays where it is: the table form [{…},{…}] is identical to the form “no labels, several subfields” of the field type JSON.

JSON
{
  "view": "table",
  "max": null,
  "fields": [
    { "key": "height", "label": "Höhe",   "type": "number" },
    { "key": "width",  "label": "Breite", "type": "number" }
  ]
}

Then set the field type under Basics to json. Two differences show up the first time a value is written back: empty strings are dropped, and {"height": 1} becomes {"height": "1"}, because the field type JSON writes strings.