Syntax Reference
Complete syntax reference for the Zoko format
This is a complete reference for the Zoko format syntax.
Basic Structure
A Zoko file consists of key-value pairs:
key: "value",
another_key: 42,
nested: {
inner_key: "inner_value",
},Value Types
Strings
Zoko supports three types of strings:
Double-Quoted Strings
message: "Hello, World!",Double-quoted strings support escape sequences like \n, \t, \\, etc.
Single-Quoted Strings
message: 'Hello, World!',Single-quoted strings are literal and don't process escape sequences.
Multi-Line Strings
message: `This is a
multi-line string
that preserves formatting`,Multi-line strings preserve the exact formatting, including newlines.
Multi-line strings automatically strip common leading whitespace, making them ideal for indented text blocks.
Numbers
integer: 42,
negative: -10,
float: 3.14,
scientific: 1.5e10,Version numbers like "1.0.0" should be quoted as strings, as they are not valid number formats.
Booleans
is_active: true,
is_debug: false,Null
optional_value: null,Arrays
// Simple array
tags: ["production", "api"],
// Array with objects
servers: [
{host: "server1", port: 8080},
{host: "server2", port: 8080},
],
// Nested arrays
matrix: [[1, 2], [3, 4]],Objects (Maps)
// Simple object
config: {
debug: true,
timeout: 30,
},
// Nested objects
database: {
primary: {
host: "localhost",
port: 5432,
},
replica: {
host: "replica.local",
port: 5432,
},
},Comments
Single-Line Comments
// This is a comment
key: "value", // Inline commentMulti-Line Comments
/*
This is a multi-line comment
that can span multiple lines
*/
key: "value",Identifiers
Keys and identifiers can contain:
- Alphanumeric characters
- Hyphens (
-) - Underscores (
_) - At signs (
@) - Forward slashes (
/) - Dots (
.)
@package/name: "value",
my-key: "value",
my_key: "value",Trailing Commas
Trailing commas are allowed everywhere:
objects: {
key1: "value1",
key2: "value2", // Trailing comma is OK
},
arrays: [
"item1",
"item2", // Trailing comma is OK
],Whitespace
Zoko is flexible with whitespace:
- Leading/trailing whitespace is ignored
- Newlines can be used freely
- Indentation is not enforced but recommended for readability
name: "value",
// These are all equivalent:
map: {id: "value", id2: "value2"},
map: {
id: "value",
id2: "value2",
},Complete Example
// Package metadata
name: "@Main/Hello",
channel: "main",
branch: "Production",
status: "Release",
version: "1.0.0",
description: "Hello package for Zoil",
// Tags and metadata
tags: ["Hello", "Zoil", "production"],
website: "https://hello.nel.co",
// Dependencies with complex structures
dependencies: [
{name: "Hola", version: "1.0.2"},
{
name: "@German/Hallo",
channel: "main",
version: "latest",
},
],
/* Configuration block
with detailed comments */
config: {
debug: false,
timeout: 30,
retries: 3,
servers: [
{host: "primary.example.com", port: 8080},
{host: "backup.example.com", port: 8080},
],
},JSON Compatibility
Zoko is designed to be compatible with JSON structures. Any valid JSON object structure can be represented in Zoko (with additional features like comments and trailing commas).
Conversion Example
Zoko:
name: "value",
number: 42,
nested: {
key: "value",
},JSON:
{
"entries": {
"name": "value",
"number": 42,
"nested": {
"key": "value"
}
}
}Type System
Zoko supports the following data types:
| Type | Example | Description |
|---|---|---|
| String | "hello", 'world', `multi` | Text data |
| Number | 42, 3.14, -10 | Numeric values |
| Boolean | true, false | True/false values |
| Null | null | Absence of value |
| Array | [1, 2, 3] | Ordered list of values |
| Object | {key: "value"} | Key-value mappings |
Escaping Rules
- In double-quoted strings: Use
\for escapes (\n,\t,\",\\) - In single-quoted strings: No escaping (literal strings)
- In multi-line strings: No escaping, preserves formatting exactly
Use single-quoted strings for Windows paths to avoid backslash escaping issues.
Syntax Errors
Common syntax errors to avoid:
- Invalid numbers:
version: 1.0.0should beversion: "1.0.0" - Unbalanced brackets: Always match
{},[],"",'' - Missing commas: Items in arrays/objects must be separated by commas
- Invalid characters in identifiers: Stick to alphanumeric,
-,_,@,/,.
2026 © All Rights Reserved.
- All the content is available under CC BY-SA 4.0, expect where otherwise stated.
- Source code is available on GitLab, licensed under Apache 2.0.
Last updated on
