Backend Development Multi-Tool Workflow 2026-04-18

UUID + JSON Database Template Workflow

Generate UUIDs for database records, format them into JSON templates, and create ready-to-use INSERT statements. Complete workflow with code examples in Bash, Python, and Node.js.

The Problem

You are seeding a database, creating test fixtures, or building mock API responses that need unique IDs, properly formatted JSON, and accurate timestamps. Generating UUIDs manually, formatting JSON by hand, and converting timestamps between formats is tedious and error-prone for large datasets.

Why This Workflow Matters

Database seeding and test fixtures require consistent, realistic data. Using sequential IDs (1, 2, 3) creates unrealistic test scenarios and can mask bugs. UUIDs provide globally unique identifiers that match production patterns. Properly formatted JSON with correct timestamps ensures your test data works identically to real API responses.

Workflow Overview

Step-by-Step Instructions

1

Generate unique UUIDs

Use the UUID Generator to create v4 UUIDs for your records. Generate as many as you need — each one is cryptographically random and globally unique.

2

Create timestamps

Use the Timestamp Converter to generate Unix timestamps or ISO 8601 dates for created_at and updated_at fields. Convert between formats as needed by your database schema.

3

Build JSON records

Combine UUIDs and timestamps into JSON objects. Paste the result into the JSON Formatter to validate syntax and pretty-print the output.

4

Export as database seed file

Copy the validated JSON array and convert it to SQL INSERT statements, a seed script, or an API bulk-create payload. The formatted JSON ensures every field is correctly typed and quoted.

Before & After

Manual IDs and unformatted data

INSERT INTO users VALUES (1, "Alice", "[email protected]");
INSERT INTO users VALUES (2, "Bob", "[email protected]");
-- Sequential IDs don't match production UUIDs
-- No timestamps, no role field

UUID-based seed with proper JSON and timestamps

[
  {
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "name": "User 1",
    "email": "[email protected]",
    "role": "admin",
    "created_at": "2026-04-18T10:30:00Z"
  }
]

Automate This Workflow

Copy these scripts to automate the workflow in your preferred language:

$ Bash
# Generate 5 database seed records
for i in $(seq 1 5); do
  UUID=$(uuidgen | tr "[:upper:]" "[:lower:]")
  TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
  echo "{ \"id\": \"$UUID\", \"name\": \"User $i\", \"created_at\": \"$TS\" }"
done | jq -s '.' > seed.json

# Convert to SQL INSERT statements
jq -r '.[] | "INSERT INTO users (id, name, created_at) VALUES (\'\(.id)\', \'\(.name)\', \'\(.created_at)\');"' \
  seed.json > seed.sql

echo "Generated $(wc -l < seed.sql) INSERT statements"
Py Python
import uuid
import json
from datetime import datetime, timezone

# Generate seed records
records = []
for i in range(1, 6):
    records.append({
        "id": str(uuid.uuid4()),
        "name": f"User {i}",
        "email": f"user{i}@example.com",
        "role": "admin" if i == 1 else "viewer",
        "created_at": datetime.now(timezone.utc).isoformat(),
        "updated_at": datetime.now(timezone.utc).isoformat(),
    })

# Save formatted JSON
with open("seed.json", "w") as f:
    json.dump(records, f, indent=2)

# Generate SQL
for r in records:
    print(f"INSERT INTO users (id, name, email, role) "
          f"VALUES ('{r['id']}', '{r['name']}', "
          f"'{r['email']}', '{r['role']}');")
JS Node.js
const crypto = require("crypto");
const fs = require("fs");

// Generate UUID v4
function uuidv4() {
  return crypto.randomUUID();
}

// Generate seed records
const records = Array.from({ length: 5 }, (_, i) => ({
  id: uuidv4(),
  name: `User ${i + 1}`,
  email: `user${i + 1}@example.com`,
  role: i === 0 ? "admin" : "viewer",
  created_at: new Date().toISOString(),
}));

// Save formatted JSON
fs.writeFileSync("seed.json",
  JSON.stringify(records, null, 2)
);

// Generate SQL
records.forEach(r => {
  console.log(
    `INSERT INTO users (id, name, email)` +
    ` VALUES ('${r.id}', '${r.name}', '${r.email}');`
  );
});

Frequently Asked Questions

Why use UUIDs instead of auto-increment IDs for test data?
UUIDs match production patterns in distributed systems. Auto-increment IDs create unrealistic test scenarios — they collide across services, reveal record counts, and do not work in multi-database architectures. UUID-based seeds catch bugs that sequential IDs mask.
Which UUID version should I use for database records?
UUID v4 (random) is the most common for general-purpose IDs. UUID v7 (time-sorted) is newer and better for database performance because it maintains insertion order. Use the UUID Generator to create both versions.
Should timestamps be stored as Unix epoch or ISO 8601?
Use ISO 8601 (2026-04-18T10:30:00Z) for human-readable storage and APIs. Use Unix timestamps (integers) for efficient storage and comparison. The Timestamp Converter converts between both formats instantly.
How do I generate realistic seed data for load testing?
Combine UUID generation with faker libraries (Python faker, JS @faker-js/faker) to generate realistic names, emails, and addresses. Use the code examples above as a starting point and add faker for realistic field values.

Related Workflows

Try These Tools Now

All tools in this workflow are free and work directly in your browser — no sign-up required.