Getting Started with YINI: A Modern, Human-Friendly Config Format
Learn the basics of YINI configuration files, from sections and values to lists, comments, and parsing in Node.js.
By Marko Seppänen · · Updated
Intro to the YINI Config Format
Originally published on DEV Community ↗ on July 23, 2025. Updated on November 28, 2026, for YINI Specification 1.0.0-RC.7.
Hi,
First you might wonder what yini actually is - a Japanese poem or? :P
- Nah, no :) YINI is a human-readable configuration file format with a formally defined grammar and a specification.
It builds on familiar INI-style settings and adds nested sections, lists, and inline objects. Section markers define the structure, so indentation is optional.
Here’s a quick example:
^ App
name = "MyApp"
enabled = true
You can try the examples in the YINI Playground.
1. Sections
Group settings under a named header. Use ^ followed by the section name:
^ App
title = "AppName"
^ is the recommended section marker. RC 7 also supports §, >, and <. This introduction uses ^ throughout.
2. Key = Value
Write a setting as key = value:
^ Server
maxConnections = 100
enableLogging = true
Simple keys and section names can contain letters, digits, and underscores, and must begin with a letter or underscore. They are case-sensitive. Use backticks for names containing spaces or hyphens:
^ `My App`
`display-name` = "MyApp"
3. Values
YINI supports these value types:
- Strings:
"hello"or'world'. Strings must be quoted. - Numbers:
42,3.14, or-10. - Booleans:
true,false,on,off,yes, orno, in any letter case. - Null:
null. - Lists:
["red", "green", "blue"]. - Inline objects:
{ enabled: true, retries: 3 }.
In lenient mode, a missing value after = in a root-level or section-level setting becomes null and produces a warning. Writing null explicitly avoids that warning and also works in strict mode.
Strings and backslashes
Ordinary quoted strings are raw: backslashes are kept literally. Use an E or e prefix when you want escape sequences such as \n to produce a newline:
^ Text
path = "C:\Projects\MyApp"
literal = "Line 1\nLine 2" // Keeps the backslash and n.
escaped = E"Line 1\nLine 2" // Contains a newline.
The older C and c string prefixes remain valid in RC 7 but are deprecated. New examples should use E or e.
4. Comments
Use // or # for line comments, /* ... */ for block comments, and ; for full-line comments:
^ Server
// This is a line comment.
timeout = 30 // An inline comment.
# This is also a line comment.
interval = 30 # Another inline comment.
/* A block comment can span
multiple lines. */
; A semicolon starts a full-line comment.
A space after # helps readability, but RC 7 does not require one. Outside strings and backticked identifiers, # begins a comment. A semicolon must be the first non-whitespace character on its line.
5. Nested Sections
Repeat ^ to create a subsection:
^ Parent
^^ Child
^^^ SubChild
Increase the nesting depth one level at a time. You can return directly to a shallower level.
Indentation is optional and can help make the hierarchy easier to see:
^ Root
value = "At level 1"
^^ Sub
value = "At level 2"
^^^ SubSub
value = "At level 3"
^ BackToRoot
value = "Back at level 1"
The result has this structure, shown as JSON:
{
"Root": {
"value": "At level 1",
"Sub": {
"value": "At level 2",
"SubSub": {
"value": "At level 3"
}
}
},
"BackToRoot": {
"value": "Back at level 1"
}
}
This example uses lenient mode because it has two top-level sections. Strict mode requires exactly one.
6. Lists and Inline Objects
Lists use square brackets and comma-separated values. They can span multiple lines:
^ App
colors = ["red", "green", "blue"]
fruits = [
"Pear",
"Cherry",
"Banana"
]
Keep the opening [ on the same line as =. The old colon-style list syntax is not part of RC 7.
Inline objects use braces, with : between each key and value:
^ App
retry = { enabled: true, attempts: 3 }
At section level, use key = value. Inside an inline object, prefer key: value. The examples omit trailing commas, which makes the collections suitable for either parsing mode.
7. Document Terminator and Parsing Modes
Lenient mode is the default. The /END marker is optional in lenient mode and required in strict mode:
^ App
title = "MyTitle"
/END
Strict mode also requires exactly one top-level section, no settings outside sections, explicit values, no duplicate keys, and no trailing commas in lists or objects. Inline object members must use :.
Adding /END makes the ending explicit; it does not select strict mode. Choose the parsing mode through your parser or tool.
The optional @yini marker identifies the format. Place it before the sections and settings, as shown in the complete example below.
8. Disabled Lines
Prefix a line with -- to disable it:
^ App
--maxRetries = 5
--userList = ["alice", "bob", "carol"]
enabled = true
Complete Example
Save this as config.yini:
@yini
^ App
name = "MyApp"
version = "1.0.0"
debug = off
features = ["search", "logs"]
retry = { enabled: true, attempts: 3 }
^^ Database
host = "db.local"
port = 5432
--user = "example-user"
^^ Logging
level = "info"
logToFile = on
filePath = "./logs/app.log"
/END
Database and Logging are both subsections of App. The disabled user setting is omitted from the result.
Load It in Node.js
Install the TypeScript/JavaScript parser:
npm install yini-parser
Save this as example.cjs:
const YINI = require('yini-parser').default;
const config = YINI.parseFile('./config.yini');
console.log(config);
Run it with node example.cjs. The resulting data is shown here as JSON:
{
"App": {
"name": "MyApp",
"version": "1.0.0",
"debug": false,
"features": ["search", "logs"],
"retry": {
"enabled": true,
"attempts": 3
},
"Database": {
"host": "db.local",
"port": 5432
},
"Logging": {
"level": "info",
"logToFile": true,
"filePath": "./logs/app.log"
}
}
}
To validate the same file in strict mode, use:
const config = YINI.parseFile('./config.yini', { strictMode: true });
YINI parsers are also available for other programming languages. See the YINI parsers overview for the available implementations.
More String Forms in RC 7
Triple double quotes allow multiline strings:
^ Text
description = """A configuration example
with two lines."""
RC 7 also supports Command Strings for multiline text with structural indentation removed:
^ Build
steps = command"""
npm ci
npm run build
"""
The opening delimiter is followed by a line break, and the closing """ is on its own line. This example produces the text npm ci followed by a newline and npm run build, without a trailing newline. YINI stores the text; it does not run the commands.
Thanks for reading!
Explore More
If you’d like to try YINI or read more:
Feedback, bug reports, feature requests, and contributions are welcome.
Bye, Marko Seppänen (author of YINI format)
