Clone
1
iKv2 Text Examples
GigabiteStudios edited this page 2026-06-17 19:12:46 -05:00
iKv2 Text Examples
These documents use the canonical ikv2 "root_name" header. Object keys and generated string values are quoted; commas are optional.
Minimal document
ikv2 "minimal"
{
"message" "hello"
}
Application settings
ikv2 "settings"
{
"window" {
"title" "Example Application"
"width" 1920
"height" 1080
"fullscreen" false
}
"audio" {
"master_volume" 0.8
"music_volume" 0.6
"effects_volume" 1.0
"muted" false
}
"language" "en-US"
}
Player save
ikv2 "player_save"
{
"save_version" 2
"timestamp" 1712345678
"player" {
"name" "Ada"
"level" 14
"health" 95
"position" {
"x" 125.5
"y" 8.0
"z" -42.25
}
}
"inventory" [
"wrench"
"battery"
"map"
]
"completed_tutorial" true
}
Typed-style scalar arrays
ikv2 "leaderboard"
{
"names" [
"Ada"
"Grace"
"Linus"
]
"scores" [
100
85
73
]
"active" [
true
false
true
]
}
The text format does not declare an array type explicitly. The parser infers a common element type when all non-null elements agree.
Array of objects
ikv2 "users"
{
"users" [
{
"id" 1
"name" "Ada"
"admin" true
}
{
"id" 2
"name" "Grace"
"admin" false
}
]
}
Mixed values and null
ikv2 "events"
{
"values" [
"started"
42
true
3.5
null
]
"optional_value" null
}
Mixed arrays retain a type tag for each element in binary output.
Comments and escaped strings
ikv2 "text_demo"
{
# Hash comments continue to the end of the line.
"title" "Escapes and comments"
// C++-style line comments are also accepted.
"multiline" "line one\nline two"
"tabbed" "left\tright"
"quoted" "She said \"hello\""
"path" "C:\\Games\\Example"
}
Service configuration
ikv2 "service"
{
"network" {
"host" "127.0.0.1"
"port" 8080
"tls" false
"timeout_seconds" 15.0
}
"logging" {
"level" "info"
"file" "logs/service.log"
"rotate" true
}
"features" {
"metrics" true
"tracing" false
"experimental" null
}
}
Comma-separated form
Commas are accepted when preferred:
ikv2 "commas"
{
"name" "demo",
"count" 3,
"values" [1, 2, 3]
}
The writer uses whitespace-separated multiline output, but both forms parse to the same tree.
iKvxx Wiki
Format Reference
C++ API
- API Overview
- Objects and Arrays
- Parsing and Serialization
- Ownership, Errors, and Limits
- C++ Examples