Data Types
This document defines all data types supported by the TON file format.
Primitive Types
String
Text values that must always be quoted:
// Single-line strings
singleQuoted = 'Hello World'
doubleQuoted = "Hello World"
// Multi-line strings
description = """
Multi-line text
with preserved formatting
"""
Number
Numeric values (always unquoted):
decimal = 123
negative = -45
float = 3.14159
scientific = 1.23e-4
hexadecimal = 0xFF
binary = 0b101010
Boolean
isActive = true
isDeleted = false
Null and Undefined
emptyValue = null // Explicitly empty
notSet = undefined // Not initialized
GUID
// Standard format
id = 550e8400-e29b-41d4-a716-446655440000
// Microsoft format
id = {f47ac10b-58cc-4372-a567-0e02b2c3d479}
Date
ISO 8601 UTC format (must be quoted):
created = "2024-03-15T10:30:00Z"
updated = '2024-03-15T14:45:30.123Z'
Enum
// Single enum value
status = |active|
// EnumSet (multiple values)
permissions = |read|write|admin|
Collection Types
Array
// Simple arrays
numbers = [1, 2, 3, 4, 5]
strings = ["a", "b", "c"]
// Mixed types
mixed = [1, "text", true, null]
// Nested arrays
matrix = [[1, 2], [3, 4], [5, 6]]
// Empty array
empty = []
Object
// Basic object
{
name = "John",
age = 30
}
// Typed object
{(person)
name = "John",
age = 30
}
// Nested objects
{(user)
name = "John",
{(address)
street = "123 Main St",
city = "Springfield"
}
}
Type Conversion Rules
TON does not perform automatic type conversion. All values maintain their specified type.
Type-Specific Validation
Each type supports specific validation rules in schemas:
- String: minLength, maxLength, pattern, format
- Number: min, max, range, multipleOf
- Array: minCount, maxCount, unique, sorted
- Date: after, before, between