YINI Parsers
Use YINI configuration files directly in application code.
YINI parsers let applications load .yini files and turn them into ordinary data structures such as objects, dictionaries, arrays, strings, numbers, booleans, and null values.
They are useful when you want configuration files that stay readable for humans while still being structured and predictable for software.
However, If you are looking for only validating YINI files, see YINI CLI.
Why use a parser?
YINI parsers are useful when you want to:
- Load YINI configuration files directly in application code.
- Parse YINI from a string or from a file.
- Work with configuration that is explicit, structured, and easy to read.
- Use a parser built specifically for the YINI format.
They are a good fit for applications, internal tools, CLIs, build scripts, and other developer workflows.
Official parsers
The YINI project currently provides official parser implementations for:
The TypeScript parser is the primary implementation. The Python parser is currently available as an alpha package for early testing, examples, integrations, and feedback.
What parsers are used for
Parsers are typically used to:
- Load application configuration at runtime.
- Parse YINI from a file or string.
- Use readable configuration in scripts, services, tools, and CLIs.
- Work with nested sections and typed values in normal application code.
- Keep configuration editable by humans without relying on indentation for structure.
Simple example
A YINI file can look like this:
^ App
name = "Demo App"
version = 1.2
debug = false
^^ Server
host = "localhost"
port = 8080A parser turns that into a normal structured value.
In JavaScript, that means an object:
{
App: {
name: "Demo App",
version: 1.2,
debug: false,
Server: {
host: "localhost",
port: 8080
}
}
}In Python, that means a dictionary:
{
"App": {
"name": "Demo App",
"version": 1.2,
"debug": False,
"Server": {
"host": "localhost",
"port": 8080,
},
}
}TypeScript / JavaScript parser (official)
Use the TypeScript parser when working with Node.js, JavaScript, or TypeScript projects.
npm install yini-parserimport YINI from 'yini-parser'
const config = YINI.parseFile('./config.yini')
console.log(config.App.name)For more details, see the page YINI Parser for Node.js
Python parser (official)
Use the Python parser when working with Python applications, scripts, tools, or services.
pip install yini-parserfrom yini_parser import load
config = load("config.yini")
print(config["App"]["name"])For more details, see the page YINI Parser for Python
YINI demo apps
For complete demo projects, see the GitHub repository:
YINI demo apps β
Learn more
- β‘οΈ YINI format overview
What YINI is and why it exists. - β‘οΈ Learn the YINI syntax
A simple introduction to sections, values, nesting, and comments.
