Skip to content

JSON import ​

Import blueprints, fields, and sample data in a single JSON file. This is the fastest way to set up a project structure: define everything in JSON, import it, and start working.

How to import ​

In the Diggama dashboard:

  1. Navigate to Blueprints in the sidebar
  2. Click the Import JSON button in the top-right corner
  3. Paste your JSON or upload a .json file
  4. Click Import

The import runs in the background. You'll receive a notification when it's done, with the number of blueprints and resources created.

TIP

If the import fails, you'll get a notification with the error message. The entire import is wrapped in a database transaction, so nothing is created on failure.

JSON format ​

The import expects a JSON array of blueprints. Each blueprint contains its definition, fields, and optional sample data:

json
[
  {
    "name": "Blog posts",
    "icon": "newspaper",
    "type": "resource",
    "record_title": "Title",
    "fields": [
      { "name": "Title", "type": "text", "rules": ["required"] },
      { "name": "Content", "type": "rich-text" }
    ],
    "data": [
      {
        "Title": "My first post",
        "Content": "<p>Hello world!</p>"
      }
    ]
  }
]

Order matters

If blueprint B has a reference field pointing to blueprint A, A must appear before B in the array, or already exist in the project.

Blueprint properties ​

PropertyTypeRequiredDescription
namestringYesDisplay name. The slug is auto-generated from this.
iconstringNoHeroicon name (default: cube). See available icons.
typestringNoresource, singular_resource, or readonly_resource (default: resource).
record_titlestringNoName of the field to use as resource title. If omitted, the first text field is used.
fieldsarrayYesField definitions (see below).
dataarrayNoSample resources to create.
variantsarrayNoMultilingual variants (see Variants).

Field properties ​

PropertyTypeRequiredDescription
namestringYesDisplay name. Also used as the key in data. The slug is auto-generated.
typestringYesOne of the 21 field types.
rulesarrayNoValidation rules, e.g. ["required"].
descriptionstringNoHelp text shown below the field.
metadataobjectNoType-specific configuration.

Field types ​

TypeJSON valueDescriptionHas metadata
TexttextSingle-line text inputNo
Rich textrich-textHTML editor (WYSIWYG)No
ChoiceenumDropdown (single select)Yes
Multi-choicemulti-enumMultiple select (tags)Yes
NumbernumberNumeric input with min/max/stepYes
MoneymoneyAmount + currencyYes
EmailemailValidated email addressNo
ImageimageImage uploadNo
FilefileFile uploadNo
LinklinkValidated URLNo
ColorcolorHex color pickerNo
DatedateDate pickerNo
Date & timedatetimeDate and time pickerNo
BooleanbooleanToggle on/offNo
SlugslugAuto-generated from another fieldYes
Relation (single)referenceLink to one resourceYes
Relation (multiple)referencesLink to multiple resourcesYes
UseruserProject member selectorNo
DurationdurationDuration in minutes/hours/daysYes
AddressaddressStructured postal addressYes
Page builderhtml-pageBlock-based page (see Page builder)Yes

Field metadata ​

Only some field types require metadata. Here's the configuration for each.

enum / multi-enum ​

json
{
  "metadata": {
    "options": {
      "draft": "draft",
      "published": "published",
      "archived": "archived"
    }
  }
}

Options are key-value pairs where key and value are identical.

For multi-enum, you can also set:

PropertyTypeDescription
min_selectionsintegerMinimum number of selections
max_selectionsintegerMaximum number of selections

number ​

json
{
  "metadata": {
    "min": 0,
    "max": 1000,
    "step": 0.01,
    "unit": "kg",
    "precision": 2,
    "format": "grouped"
  }
}

All properties are optional:

PropertyTypeDescription
minnumberMinimum value
maxnumberMaximum value
stepnumberIncrement (default: 1)
unitstringSuffix label (e.g. kg, %)
precisionintegerDecimal places to display
formatstring"grouped" for thousand separators

money ​

json
{
  "metadata": {
    "default_currency": "EUR",
    "currencies": ["EUR", "USD", "GBP"]
  }
}
PropertyTypeDescription
default_currencystringISO currency code (default: EUR)
currenciesarrayAllowed currencies (all if omitted)

Supported currencies: EUR, USD, GBP, CHF, CAD, AUD, JPY, CNY, SEK, NOK, DKK, PLN, CZK, HUF, RON, BGN, HRK, INR, BRL, MXN, ZAR, TRY, RUB, KRW, SGD, HKD, NZD, THB, TWD, AED, SAR, ILS, MAD, XOF, XAF.

slug ​

json
{
  "metadata": {
    "source": "title"
  }
}

source is the slug of the source field (auto-generated from the field name).

reference / references ​

Use reference_to with the slug of the target blueprint. The import resolves it to the internal ID automatically:

json
{
  "metadata": {
    "reference_to": "categories"
  }
}

The target blueprint can be in the same import (declared earlier) or already exist in the project.

Additional options for references:

PropertyTypeDescription
minintegerMinimum number of selections
maxintegerMaximum number of selections
display_fieldsstring or arrayField slug(s) to show in the selector

duration ​

json
{
  "metadata": {
    "unit": "minutes",
    "min": 0,
    "max": 480,
    "display_format": "auto"
  }
}
PropertyTypeDescription
unitstringminutes, hours, or days (default: minutes)
minnumberMinimum value
maxnumberMaximum value
display_formatstringauto, minutes, hours, or hhmm (default: auto)

address ​

json
{
  "metadata": {
    "default_country": "FR",
    "countries": ["FR", "BE", "CH", "CA"]
  }
}
PropertyTypeDescription
default_countrystringISO country code
countriesarrayAllowed countries (all if omitted)

html-page ​

json
{
  "metadata": {
    "blocks": ["hero", "features", "cta"],
    "template": null
  }
}
PropertyTypeDescription
blocksarrayBlock types editors may add (all if omitted or empty). See the block reference
templatestringStarting template that pre-fills new pages

Sample data ​

The data array contains resources to create. Each entry is an object where keys are field names (not slugs): the import maps them automatically.

json
{
  "data": [
    {
      "Title": "My post",
      "Category": "news",
      "Featured": true
    }
  ]
}

All imported resources are published immediately.

Data values by field type ​

Field typeValue formatExample
textstring"Hello"
rich-textstring (HTML)"<p>Hello <b>world</b></p>"
enumstring"news"
multi-enumarray of strings["news", "featured"]
numbernumber42.5
moneyobject{"amount": 29.99, "currency": "EUR"}
emailstring"[email protected]"
imagestring or nullnull
filestring or nullnull
linkstring (URL)"https://example.com"
colorstring (hex)"#FF5733"
datestring"2026-01-15"
datetimestring"2026-01-15 14:30:00"
booleanbooleantrue
slugstring"my-post"
referencestring (target resource slug)"acme-corp"
referencesarray of strings (slugs)["tag-1", "tag-2"]
userinteger (user ID)1
durationnumber90
addressobject{"street": "1 Main St", "city": "Paris", "postal_code": "75001", "country": "FR"}
html-pageobject (block tree){"version": 1, "blocks": [{"id": "hero-1", "type": "hero", "props": {"title": "Hello"}}]}

Address sub-fields ​

FieldTypeDescription
streetstringStreet line 1
street2stringStreet line 2 (optional)
postal_codestringPostal / ZIP code
citystringCity
statestringState or region (optional)
countrystringISO country code (e.g. FR)

Cross-blueprint references in data ​

Reference and references fields accept resource slugs as values. The import resolves them to internal IDs automatically.

For this to work, the target resource must have a field named Slug (or slug) in its data:

json
[
  {
    "name": "Categories",
    "fields": [
      { "name": "Name", "type": "text", "rules": ["required"] },
      { "name": "Slug", "type": "slug", "metadata": { "source": "name" } }
    ],
    "data": [
      { "Name": "Tech", "Slug": "tech" }
    ]
  },
  {
    "name": "Posts",
    "fields": [
      { "name": "Title", "type": "text", "rules": ["required"] },
      { "name": "Category", "type": "reference", "metadata": { "reference_to": "categories" } }
    ],
    "data": [
      { "Title": "My post", "Category": "tech" }
    ]
  }
]

The value "tech" in the Category field is resolved to the internal ID of the "Tech" resource.

Variants ​

To import multilingual blueprints, add a variants array:

json
{
  "name": "Pages",
  "variants": [
    { "name": "English", "slug": "en", "is_default": true },
    { "name": "French", "slug": "fr", "is_default": false }
  ],
  "fields": [ ... ]
}
PropertyTypeDescription
namestringDisplay name
slugstringVariant identifier (e.g. en, fr)
is_defaultbooleanExactly one variant must be the default

Available icons ​

Icons are Heroicons (outline style). Use just the name without any prefix:

academic-cap adjustments-horizontal archive-box arrow-down-tray arrow-trending-up banknotes beaker bell bolt book-open bookmark briefcase building-office building-storefront calculator calendar camera chart-bar chart-pie chat-bubble-left-right check-circle clipboard-document-list clock cloud code-bracket cog command-line credit-card cube currency-dollar document document-text envelope face-smile film fire flag folder gift globe-alt heart home inbox key light-bulb link list-bullet lock-closed map megaphone musical-note newspaper paint-brush paper-airplane pencil phone photo puzzle-piece rocket-launch server shopping-bag shopping-cart sparkles star tag ticket trophy truck tv user user-group video-camera wallet wrench x-circle

Full example ​

A complete CRM import with cross-blueprint references:

json
[
  {
    "name": "Companies",
    "icon": "building-office",
    "type": "resource",
    "record_title": "Name",
    "fields": [
      { "name": "Name", "type": "text", "rules": ["required"] },
      { "name": "Slug", "type": "slug", "metadata": { "source": "name" } },
      { "name": "Website", "type": "link" },
      { "name": "Industry", "type": "enum", "metadata": { "options": { "SaaS": "SaaS", "E-commerce": "E-commerce", "Fintech": "Fintech" } } },
      { "name": "Employees", "type": "number", "metadata": { "min": 1, "format": "grouped" } },
      { "name": "Revenue", "type": "money", "metadata": { "default_currency": "USD" } },
      { "name": "Active", "type": "boolean" }
    ],
    "data": [
      {
        "Name": "Acme Corp",
        "Slug": "acme-corp",
        "Website": "https://acme.com",
        "Industry": "SaaS",
        "Employees": 150,
        "Revenue": { "amount": 5000000, "currency": "USD" },
        "Active": true
      },
      {
        "Name": "GreenCart",
        "Slug": "greencart",
        "Website": "https://greencart.com",
        "Industry": "E-commerce",
        "Employees": 15,
        "Revenue": { "amount": 800000, "currency": "USD" },
        "Active": true
      }
    ]
  },
  {
    "name": "Contacts",
    "icon": "user-group",
    "type": "resource",
    "record_title": "Name",
    "fields": [
      { "name": "Name", "type": "text", "rules": ["required"] },
      { "name": "Email", "type": "email", "rules": ["required"] },
      { "name": "Company", "type": "reference", "metadata": { "reference_to": "companies" } },
      { "name": "Role", "type": "text" },
      { "name": "Status", "type": "enum", "metadata": { "options": { "New": "New", "Contacted": "Contacted", "Qualified": "Qualified", "Won": "Won", "Lost": "Lost" } } },
      { "name": "Tags", "type": "multi-enum", "metadata": { "options": { "decision-maker": "decision-maker", "technical": "technical", "vip": "vip" } } }
    ],
    "data": [
      {
        "Name": "Sarah Chen",
        "Email": "[email protected]",
        "Company": "acme-corp",
        "Role": "Head of Marketing",
        "Status": "Qualified",
        "Tags": ["decision-maker"]
      },
      {
        "Name": "Emily Parker",
        "Email": "[email protected]",
        "Company": "greencart",
        "Role": "Founder",
        "Status": "Won",
        "Tags": ["decision-maker", "vip"]
      }
    ]
  }
]

Diggama Documentation