Jsson Docs
Guides

Validators Guide

Auto-generate realistic test data with built-in validators.

Overview

Validators generate valid data automatically. Prefix them with @.

user {
  id = @uuid
  email = @email
  age = @int(18, 65)
}

Available Validators

ValidatorDescriptionExample Output
@uuidUUID v4550e8400-e29b-41d4-...
@emailEmailuser@example.com
@urlURLhttps://example.com
@ipv4IPv4 address192.168.1.1
@ipv6IPv6 address2001:0db8:85a3::...
@dateDate2025-12-23
@datetimeISO datetime2025-12-23T15:30:00Z
@filepathFile path/var/log/app.log
@int(min, max)Random integer42
@float(min, max)Random float3.14159
@boolRandom booleantrue or false

Examples

User Generation

user {
  id = @uuid
  email = @email
  age = @int(18, 65)
  score = @float(0.0, 100.0)
  verified = @bool
  created = @datetime
}

With Templates

users [
  template { name }
  
  map (u) = {
    id = @uuid
    name = u.name
    email = @email
    age = @int(25, 60)
  }
  
  "Alice"
  "Bob"
  "Charlie"
]

Large Dataset

testData = 1..1000 map (i) = {
  id = @uuid
  index = i
  email = @email
  active = @bool
  created = @datetime
}

Server Config

servers [
  template { name, region }
  
  map (s) = {
    id = @uuid
    name = s.name
    region = s.region
    ip = @ipv4
    port = @int(8000, 9000)
  }
  
  "web", "us-east"
  "api", "us-west"
  "db", "eu-central"
]

Use Cases

  • Testing — Realistic test data without hardcoding
  • Database seeding — Populate dev databases
  • Mock APIs — Generate API responses
  • Load testing — Large datasets for performance

Best Practices

// ✅ Good: Dynamic data
user {
  id = @uuid
  email = @email
}

// ❌ Bad: Hardcoded
user {
  id = "123"
  email = "test@test.com"
}

Use realistic ranges:

player {
  age = @int(13, 80)      // Realistic
  score = @float(0, 100)  // Percentage
}

On this page