Static Values
Any field without a "gen" keyword is treated as a static (literal) value.
Basic Static Values
{
"users": {
"count": 5,
"item": {
"id": {"gen": "uuid"},
"role": "user",
"active": true,
"version": 1
}
}
}
Output:
{
"users": [
{
"id": "550e8400-...",
"role": "user",
"active": true,
"version": 1
}
]
}
Supported Types
Strings
{
"status": "pending",
"message": "Hello World",
"empty": ""
}
Numbers
{
"count": 42,
"price": 19.99,
"negative": -10,
"zero": 0
}
Booleans
{
"active": true,
"deleted": false,
"verified": true
}
Null
{
"middleName": null,
"deletedAt": null
}
Objects
{
"metadata": {
"version": 1,
"type": "standard",
"features": {
"premium": false,
"trial": true
}
}
}
Arrays
{
"roles": ["user", "viewer"],
"permissions": ["read", "write"],
"tags": [],
"scores": [10, 20, 30, 40, 50]
}
Mixing Static and Generated Values
Combine static and generated values in the same item:
{
"users": {
"count": 10,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "name.fullName"},
"role": "user",
"active": true,
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {
"version": 1,
"source": "api"
}
}
}
}
Static Values in Nested Objects
{
"products": {
"count": 20,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "lorem.word"},
"pricing": {
"currency": "USD",
"taxRate": 0.08,
"amount": {"gen": "float", "min": 9.99, "max": 999.99, "decimals": 2}
},
"metadata": {
"version": 1,
"schema": "v2",
"flags": {
"featured": false,
"onSale": false
}
}
}
}
}
Static Arrays with Generated Items
Arrays can have static structure with generated content:
{
"users": {
"count": 5,
"item": {
"id": {"gen": "uuid"},
"roles": ["user", "viewer"],
"contacts": [
{
"type": "email",
"value": {"gen": "internet.emailAddress"},
"primary": true
},
{
"type": "phone",
"value": {"gen": "phone.phoneNumber"},
"primary": false
}
]
}
}
}
Common Patterns
Default Values
{
"users": {
"count": 100,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "name.fullName"},
"role": "user",
"status": "active",
"emailVerified": false,
"phoneVerified": false,
"twoFactorEnabled": false
}
}
}
Configuration Objects
{
"applications": {
"count": 10,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "lorem.word"},
"config": {
"timeout": 30000,
"retries": 3,
"debug": false,
"endpoints": {
"api": "https://api.example.com",
"cdn": "https://cdn.example.com"
}
}
}
}
}
Versioning
{
"documents": {
"count": 50,
"item": {
"id": {"gen": "uuid"},
"content": {"gen": "lorem.paragraph"},
"version": 1,
"schemaVersion": "2.0",
"format": "markdown"
}
}
}
Timestamps
{
"records": {
"count": 100,
"item": {
"id": {"gen": "uuid"},
"data": {"gen": "lorem.sentence"},
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": {"gen": "date", "format": "iso_datetime"},
"deletedAt": null
}
}
}
Feature Flags
{
"users": {
"count": 50,
"item": {
"id": {"gen": "uuid"},
"name": {"gen": "name.fullName"},
"features": {
"darkMode": {"gen": "boolean", "probability": 0.7},
"betaAccess": false,
"premiumTrial": false,
"notifications": true
}
}
}
}
When to Use Static Values
Use static values when:
- Default Values: All items should have the same default value
- Configuration: Fixed configuration that doesn't change
- Versioning: Schema or API version numbers
- Type Indicators: Fixed type or category identifiers
- Flags: Boolean flags that are initially false
- Null Placeholders: Fields that are initially null
Use generators when:
- Variation Needed: Each item should have different values
- Realistic Data: Need realistic-looking data (names, emails, etc.)
- Random Values: Need random numbers, dates, or choices
- Relationships: Need to reference other collections
Combining with Choice Generator
For controlled variation, use Choice with static options:
{
"users": {
"count": 100,
"item": {
"id": {"gen": "uuid"},
"role": {
"gen": "choice",
"options": ["user", "admin", "moderator"],
"weights": [85, 10, 5]
},
"status": "active",
"tier": {
"gen": "choice",
"options": ["free", "premium"],
"weights": [80, 20]
}
}
}
}
Best Practices
- Use Static for Constants: Don't generate values that should be constant
- Mix Appropriately: Combine static and generated values naturally
- Document Defaults: Comment why certain values are static
- Consider Choice: Use Choice generator for controlled variation
- Null for Optional: Use
nullfor optional fields that may be populated later
Next Steps
- Generators - Explore all generators
- Choice Generator - Controlled variation
- References - Create relationships