The Conveyor Belt • Engine 2 of the JSON Transformer Suite

The Conveyor Belt (1D Collection Engine)

One element template. An array of data objects on the conveyor. A continuous stream of resolved JSON AST element nodes.

Flagship Workspaces • Render v2 & Studio v3

Decoupled Two-Tab Render Studio & 3-Column IDE

Experience the latest architecture: Tab 1 (The Foundry) gives you a full 3-column Monaco workspace (Source + Template + Output with Transform hook), while Tab 2 (The Canvas) runs clean, unbloated live HTML powered by BroadcastChannel and the JSON-to-DOM engine!

Two-Tab Decoupled BroadcastChannel Sync 3-Column Monaco IDE Pure HTML DOM Stage

The Mental Model: The Conveyor Belt

In the KeshavSoft ecosystem, 0D (`primitive`) is the mold: it stamps one piece of data into one element. But user interfaces are filled with linear repetition — an array of column definitions stamping into table headers (<th>), width definitions stamping into <col> tags, or record rows stamping into dropdown <option> tags.

Engine 2 (`one-dimension`) is the Conveyor Belt: you place a stream (array) of data objects onto the belt. As each object passes under the stamp, the engine transforms it through a template and emits a continuous, predictable array of sibling element nodes.

Two Operating Modes:
  • Uniform Stamping (fromCollection(source, template)): Every item on the conveyor is stamped using the same identical template mold.
  • Heterogeneous Stamping (loopWithIndividualTemplate(source, templateKey)): Each item carries its own template specification key, allowing diverse element shapes on a single conveyor pass.

The JSON Transformer Family

How the one-dimensional collection engine fits into the overall declarative rendering ecosystem:

Engine 1 · 0D

Primitive Engine

Transforms one object with one template into one element node. Resolves ${placeholders} and tag attributes.

Engine 2 · 1D (This Repo)

One-Dimensional Engine

Transforms a list of objects with one template into a list of sibling element nodes (e.g. <th>, <col>, <option>).

Engine 3 · 2D

Two-Dimensional Engine

Combines rows and columns across both dimensions to construct full table bodies (<tbody> with nested <tr> and <td>).

The Heart: Pure, Guarded Transformation

Internally, the engine delegates to the primitive engine with guaranteed linear runtime:

import fromCollection from "json-transformer-funcs-one-dimension";

// Signature:
const output = fromCollection(inSource, inTemplate);

// Heart of the implementation:
return inSource.map(element => applyTemplate(inTemplate, element));
Strict Guards (Throws on violation)
  • inSource must be a non-empty Array.
  • Every item in inSource must be a plain object.
  • inTemplate must be an Object or String.
Guaranteed Output
  • Pure function with zero side effects.
  • Preserves array length: output.length === inSource.length.
  • Ready for JSON serialization or direct DOM rendering.

Practical Transformation Examples

See how identical engine logic handles table columns and dropdown items seamlessly:

Example 1: Table Headers (<th>) Columns → Headers
// Source Columns:
const columns = [
  { "columnName": "itemName" },
  { "columnName": "baseUnit" },
  { "columnName": "batches" }
];

// Single Template:
const template = {
  "tagName": "th",
  "textContent": "${columnName}"
};

// Result:
fromCollection(columns, template);
/*
[
  { "tagName": "th", "textContent": "itemName" },
  { "tagName": "th", "textContent": "baseUnit" },
  { "tagName": "th", "textContent": "batches" }
]
*/
Example 2: Dropdown Options (<option>) Data → Dropdown
// Source Items:
const items = [
  { "label": "Cash Account", "id": "A101" },
  { "label": "Bank Account", "id": "A102" }
];

// Single Template:
const template = {
  "tagName": "option",
  "textContent": "${label}",
  "attributes": { "value": "${id}" }
};

// Result:
fromCollection(items, template);
/*
[
  { "tagName": "option", "textContent": "Cash Account", "attributes": { "value": "A101" } },
  { "tagName": "option", "textContent": "Bank Account", "attributes": { "value": "A102" } }
]
*/
Want to experiment with these templates live? Open in Two-Tab Render Studio Open in 3-Column Studio v3
Modern • Monaco Studios

Interactive 1D Monaco Studios & Playgrounds

Test linear collection mapping live in full-screen Monaco Editor workspaces — from the cutting-edge Two-Tab Live Render Studio (v2) and 3-Column Studio (v3), to the flagship 50/50 Dual-Pane Studio (v1) and legacy generations.