Source Template Format Reference

Source Template Format Reference

This page documents the JSON format for creating custom source templates. For an introduction to using templates, see Source Templates.

JSON structure

A template is a single JSON object. The root-level properties are:

PropertyRequiredDefaultDescription
idYesUnique identifier, becomes the source type (e.g. "uk_1851_census")
titleYesDisplay name shown in the Template drop-down
typeYesFact type code: CENS, BIRT, MARR, DEAT, BAPM, etc.
dateNoDefault date for the record
rotated_normallyNofalseRotate table 90° in reports
portrait_in_a4NofalseOverride rotation for A4 paper
portrait_in_b5NofalseOverride rotation for B5 paper
sectionsYesArray of section definitions

The sections array is where the template’s layout is defined. Each section has a type that determines its structure.

Section types
fields

Label/value pairs, suitable for certificate headers and single-entry data.

table

Repeating rows, suitable for census households and lists.

Data is stored as {row_prefix}{number}{column_id}, e.g. ROW0_NAME, ROW1_AGE.

named_rows

Fixed rows with labels, suitable for husband/wife sections on marriage certificates.

Data is stored as {prefix}{column_id}, e.g. HUSB_NAME, WIFE_AGE.

flow

Inline text with embedded fields, suitable for certificate headings and running prose.

A text part has "text" with literal text. Use "\n" for line breaks. A field part has "field" (the field id) and "width". Both text and field parts accept an optional "style": "bold", "italic", or "bold_italic".

Column and field properties

These properties apply to entries in the fields, columns, and flow field parts arrays.

PropertyRequiredDefaultDescription
idYesField identifier (e.g. "_NAME", "_AGE")
labelYesLabel shown in the entry form
headingNoSame as labelHeading in report tables (can be more formal)
widthNo10Width in characters (entry form) and proportional column width (reports)
alignNo"centre"Text alignment: "left", "centre", "right"
heightNo1Height in lines (values greater than 1 create a multi-line field)
no_returnNofalsePrevent Enter key in multi-line fields
completerNoAuto-completion helper (see Available completers)
validatorNoValidation helper
Available completers

Completers provide auto-suggestions as you type. Assign one to a field with the completer property.

NameSuggests
census_namePerson names from the database
census_placePlaces from the place database
census_occupationHistorical occupations
census_occupation_1911Occupations with 1911-era classifications
census_relationshipHousehold relationships (Head, Wife, Son, etc.)
census_statusMarital status (Married, Unmarried, Widowed)
census_languageLanguages (for Welsh/Irish censuses)
census_1939_status1939 Register status codes
gro_districtsGRO registration districts
gro_districts_prefixedGRO districts with volume prefix
scottish_districts_prefixedScottish registration districts
regionEnglish and Welsh regions
scottish_regionScottish regions
marriage_venueChurch and chapel names
marriage_byOfficiants
church_or_chapelChurch or Chapel
banns_or_licenceBanns or Licence
monthMonth names
calendar_daysDays 1-31
seven_or_eight7d or 8d (registration fees)
Multi-row headers

For report tables with grouped columns (common in census templates), use the header_rows property instead of auto-generated headings. This is an array of rows, each containing an array of cells.

Each cell supports:

PropertyDefaultDescription
textHeader text (use \n for line breaks)
colspan1Number of columns this cell spans
rowspan1Number of rows this cell spans
align"centre""left", "centre", "right"
sizeFont size: xx_small, x_small, small, medium, large, x_large, xx_large

When header_rows is present, the individual column heading values are ignored in favour of the custom header layout.

Example: simple census template
{
"id": "my_census",
"title": "My Census",
"type": "CENS",
"date": "1 Apr 1801",
"sections": [
{
"type": "table",
"row_prefix": "ROW",
"max_rows": 10,
"columns": [
{ "id": "_NAME", "label": "Name", "width": 15,
"align": "left", "completer": "census_name" },
{ "id": "_AGE", "label": "Age", "width": 4 },
{ "id": "_OCCU", "label": "Occupation", "width": 15,
"completer": "census_occupation" },
{ "id": "_PLACE", "label": "Birthplace", "width": 15,
"completer": "census_place" }
]
}
]
}

This creates a census table with four columns. Each row stores data under keys like ROW0_NAME, ROW0_AGE, ROW1_NAME, and so on.

Example: birth certificate template
{
"id": "my_birth_cert",
"title": "Birth Certificate",
"type": "BIRT",
"sections": [
{
"type": "flow",
"parts": [
{ "text": "Births in the District of " },
{ "field": "REG_DIST", "width": 15, "style": "bold" },
{ "text": "\nin the Sub-District of " },
{ "field": "SUB_DIST", "width": 15, "style": "bold" }
]
},
{
"type": "fields",
"borders": "thin",
"fields": [
{ "id": "WHEN_BORN", "label": "When Born", "width": 15 },
{ "id": "WHERE_BORN", "label": "Where Born", "width": 20,
"completer": "census_place" },
{ "id": "NAME", "label": "Name", "width": 20 },
{ "id": "SEX", "label": "Sex", "width": 6 },
{ "id": "FATH_NAME", "label": "Father’s Name",
"width": 20 },
{ "id": "FATH_OCCU", "label": "Father’s Occupation",
"width": 20, "completer": "census_occupation" },
{ "id": "MOTH_NAME", "label": "Mother’s Name",
"width": 20 },
{ "id": "MOTH_MAIDEN", "label": "Mother’s Maiden Name",
"width": 15 }
]
}
]
}

This combines a flow section for the certificate heading (with inline bold fields for district names) and a fields section for the certificate body. The fact type BIRT means Pedigree Forge will automatically set the source’s fact type to Birth.