Skip to main content
JDM (JSON Decision Model) is the file format used by GoRules to represent decision graphs. It’s a human-readable JSON structure that captures nodes, edges, and configuration in a portable format.

Why JDM?

BenefitDescription
PortableWorks across all GoRules SDKs and tools
Version controllableStore in Git alongside your code
Human readableReview and diff changes easily
ExtensibleAdd custom metadata without breaking compatibility

File structure

A JDM file contains three main sections:
{
  "nodes": [...],
  "edges": [...],
  "metadata": {...}
}

Nodes

Each node represents a processing step in the decision:
{
  "id": "node-1",
  "type": "decisionTableNode",
  "name": "Customer Discount",
  "position": { "x": 200, "y": 100 },
  "content": {
    // Node-specific configuration
  }
}

Edges

Edges define connections between nodes:
{
  "id": "edge-1",
  "sourceId": "input-node",
  "targetId": "decision-table-node",
  "sourceHandle": "output",
  "targetHandle": "input"
}

Metadata

Optional metadata about the decision:
{
  "metadata": {
    "version": "1.0.0",
    "author": "[email protected]",
    "description": "Customer discount calculation",
    "tags": ["pricing", "discounts"]
  }
}

Loading JDM files

Load and evaluate JDM files using any GoRules SDK:

Validating structure

The @gorules/jdm-editor package exports a Zod schema for validating JDM files:
import { decisionModelSchema } from '@gorules/jdm-editor/dist/schema';

const content = JSON.parse(await file.text());
const result = decisionModelSchema.safeParse(content);

if (!result.success) {
  console.error('Invalid JDM:', result.error.issues);
}

Version control best practices

File organization

rules
pricing
customer-discount.json
volume-discount.json
eligibility
loan-qualification.json
README.md

Meaningful commits

git commit -m "Add enterprise tier discount (20% for orders > $10k)"

Review diffs

JDM’s JSON format makes diffs readable:
  "rules": [
    {
      "inputEntries": [{ "value": "\"gold\"" }],
-     "outputEntries": [{ "value": "0.15" }]
+     "outputEntries": [{ "value": "0.20" }]
    }
  ]

Exporting from BRMS

The GoRules BRMS exports decisions in JDM format:
  1. Open the decision in BRMS
  2. Click Export in the toolbar
  3. Choose JSON Decision Model (.json)
  4. Save to your repository

Schema reference

The complete JSON Schema for JDM files is available in the zen repository.