Tabular Operations

v1.0.0
Structure
arraydestructive

Description

Tabular Operations

Build a sequence of spreadsheet-like row operations on JSON arrays. Works like a mini data pipeline — operations execute in order, each transforming the output of the previous step.

Operations

FILTER

Keep rows matching a condition expression.

FILTER {{ age >= 18 }}
FILTER {{ status === "active" }}

ADD COLUMN

Create a new column from an expression.

ADD COLUMN fullName = {{ firstName + " " + lastName }}
ADD COLUMN tax = {{ salary * 0.1 }}

RENAME COLUMN

Rename a column, preserving row field order.

RENAME COLUMN firstName TO first_name

REMOVE COLUMN

Delete one or more columns from all rows.

REMOVE COLUMN tempId, debugFlag

SORT BY

Sort rows by a field. Default direction is ASC. Nulls sort to end.

SORT BY age DESC
SORT BY name ASC

DEDUPLICATE BY

Keep only the first occurrence per unique key combination.

DEDUPLICATE BY email
DEDUPLICATE BY firstName, lastName

DSL Mode

Switch to DSL mode for a text-based interface. One operation per line, comments start with #.

# Clean up user data
FILTER {{ age >= 18 }}
REMOVE COLUMN tempId, debugFlag
ADD COLUMN fullName = {{ firstName + " " + lastName }}
SORT BY fullName ASC
DEDUPLICATE BY email

Expressions

Expressions use {{ }} syntax and support field references, arithmetic, string concatenation, and comparisons:

  • {{ age >= 18 }} — boolean comparison
  • {{ firstName + " " + lastName }} — string concatenation
  • {{ price * quantity }} — arithmetic

Configuration

NameTypeDefaultDescription
Modeenumdocument-rowdocument-row treats an object document as one formula row. array-path edits each item in a selected nested array. document-row array-path
Source Arraypath-pickerSelect the nested array whose items should be edited as tabular rows.
Operationstabular-operations[]Build a sequence of spreadsheet-like row operations. Switch to DSL mode for a text-based interface.

Examples

AI Prompt
Apply tabular operations to the items array and calculate each item's line total.
Input
1{
2 "order_id": "ord_1049",
3 "customer": {
4 "name": "Maya Chen",
5 "email": "maya@example.com"
6 },
7 "items": [
8 {
9 "sku": "tee_black_m",
10 "qty": 2,
11 "price": "24.00"
12 },
13 {
14 "sku": "cap_white",
15 "qty": 1,
16 "price": "18.00"
17 }
18 ],
19 "payments": [
20 {
21 "status": "failed",
22 "amount": 66
23 },
24 {
25 "status": "paid",
26 "amount": 66
27 }
28 ]
29}
Config
Mode
array-path
Source Array
items
Operations
ADD COLUMN line_total = {{ qty * price }}
Output
1{
2 "order_id": "ord_1049",
3 "customer": {
4 "name": "Maya Chen",
5 "email": "maya@example.com"
6 },
7 "items": [
8 {
9 "sku": "tee_black_m",
10 "qty": 2,
11 "price": "24.00",
12 "line_total": 48
13 },
14 {
15 "sku": "cap_white",
16 "qty": 1,
17 "price": "18.00",
18 "line_total": 18
19 }
20 ],
21 "payments": [
22 {
23 "status": "failed",
24 "amount": 66
25 },
26 {
27 "status": "paid",
28 "amount": 66
29 }
30 ]
31}

API Usage

POST /api/v1/utilities/structure.tabular-ops
Example:
curl -X POST https://your-domain.com/api/v1/utilities/structure.tabular-ops \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"primary":{"order_id":"ord_1049","customer":{"name":"Maya Chen","email":"maya@example.com"},"items":[{"sku":"tee_black_m","qty":2,"price":"24.00"},{"sku":"cap_white","qty":1,"price":"18.00"}],"payments":[{"status":"failed","amount":66},{"status":"paid","amount":66}]}},"config":{"mode":"array-path","sourcePath":"items","operations":[{"type":"addColumn","name":"line_total","formula":"{{ qty * price }}"}]}}'
Response
1{
2 "order_id": "ord_1049",
3 "customer": {
4 "name": "Maya Chen",
5 "email": "maya@example.com"
6 },
7 "items": [
8 {
9 "sku": "tee_black_m",
10 "qty": 2,
11 "price": "24.00",
12 "line_total": 48
13 },
14 {
15 "sku": "cap_white",
16 "qty": 1,
17 "price": "18.00",
18 "line_total": 18
19 }
20 ],
21 "payments": [
22 {
23 "status": "failed",
24 "amount": 66
25 },
26 {
27 "status": "paid",
28 "amount": 66
29 }
30 ]
31}