@jsonic/ini
v0.9.1
Published
This plugin allows the [Jsonic](https://jsonic.senecajs.org) JSON parser to support INI syntax.
Readme
@jsonic/ini
A Jsonic syntax plugin that parses INI format files into objects with support for sections, nested keys, arrays, multiline values, and inline comments.
Available for TypeScript and Go.
|
| This open source module is sponsored and supported by Voxgig. |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------- |
Tutorials
Learn by building working examples from scratch.
- Parse a basic INI file (TypeScript)
- Parse a basic INI file (Go)
- Parse nested sections and arrays (TypeScript)
- Parse nested sections and arrays (Go)
- Parse with multiline values (TypeScript)
- Parse with multiline values (Go)
How-to guides
Solve specific problems with INI configuration.
- Enable inline comments (TypeScript) | (Go)
- Escape inline comment characters (TypeScript) | (Go)
- Control duplicate section handling (TypeScript) | (Go)
- Use boolean keys (TypeScript) | (Go)
Explanation
Understand how the INI parser works under the hood.
Reference
Complete API documentation for each language.
Quick example
Parse an INI file with sections, keys, and arrays:
TypeScript
const j = Jsonic.make().use(Ini)
j("[database]\nhost = localhost\nport = 5432\ntags[] = primary\ntags[] = read")
// { database: { host: 'localhost', port: '5432', tags: ['primary', 'read'] } }Go
result, err := ini.Parse("[database]\nhost = localhost\nport = 5432\ntags[] = primary\ntags[] = read")
// map[string]any{"database": map[string]any{"host": "localhost", "port": "5432", "tags": []any{"primary", "read"}}}License
MIT. Copyright (c) Richard Rodger and other contributors.
