Type System

Tauq supports all JSON-compatible types with additional syntax conveniences for token efficiency.

Primitive Types

Strings

Strings can be barewords (unquoted) or quoted. Barewords are more token-efficient.

# Barewords (preferred for simple strings)
name Alice
status active
path /api/v1/users
email user@example.com

# Quoted strings (required for spaces, special chars)
message "Hello, World!"
query "SELECT * FROM users"
multiline "Line 1\nLine 2"
Bareword-safe characters: alphanumeric, _, -, ., @, /, +

Numbers

Integers and floating-point numbers. No quotes needed.

# Integers
count 42
negative -17
large 1000000

# Floating point
price 29.99
rate 0.05
scientific 1.5e10

# Special numeric values
infinity Infinity
neg_infinity -Infinity

Booleans

Standard boolean values. Case-sensitive.

enabled true
disabled false

# In schema records
!def Feature name enabled
dark_mode true
beta_api false

Null

Represents absence of value.

optional_field null
deleted_at null

# In schema records
!def User id name email deleted_at
1 Alice alice@example.com null
2 Bob bob@example.com "2024-01-15"

Collection Types

Arrays

Ordered collections using square brackets. Space-delimited for efficiency.

# Simple arrays (space-delimited)
numbers [1 2 3 4 5]
names [Alice Bob Carol]
tags [api production v2]

# Mixed types
mixed [1 "hello" true null]

# Nested arrays
matrix [[1 2 3] [4 5 6] [7 8 9]]

# Multi-line arrays
features [
  authentication
  logging
  metrics
  rate_limiting
]

Objects

Key-value pairs using curly braces.

# Inline objects
point { x 10 y 20 }
config { host localhost port 8080 }

# Nested objects
server {
  host 0.0.0.0
  port 8080
  ssl {
    enabled true
    cert /etc/ssl/cert.pem
  }
}

# Object with array values
user {
  id 1
  name Alice
  roles [admin editor]
  metadata { created "2024-01-01" }
}

Type Inference

Automatic Type Detection

Tauq automatically infers types based on value syntax:

Value Detected Type JSON Output
42 Integer 42
3.14 Float 3.14
true / false Boolean true / false
null Null null
"hello" String (quoted) "hello"
hello String (bareword) "hello"
[1 2 3] Array [1, 2, 3]
{ x 1 } Object { "x": 1 }

String Quoting Rules

When to Quote Strings

No Quotes Needed:

simple_word
user@example.com
/api/v1/users
my-component
file.txt
version+beta

Quotes Required:

"has spaces"
"with:colons"
"special!chars"
"true"          # String "true", not boolean
"123"           # String "123", not number
""              # Empty string
"line1\nline2" # Contains escape sequence

Escape Sequences

Quoted strings support standard escape sequences:

Sequence Meaning Example
\\n Newline "line1\\nline2"
\\t Tab "col1\\tcol2"
\\\\ Backslash "C:\\\\Users"
\\" Quote "Say \\"hello\\""
\\uXXXX Unicode "\\u0041" (A)

Learn More

Continue exploring Tauq's features.