Class IniParser

All Implemented Interfaces:
IniMetaProvider, RecordReadable

public class IniParser extends ReaderParser implements IniMetaProvider, RecordReadable
Parses INI-formatted text into POJO models.

Parses INI files (section/key-value format) into Java beans and maps.

Media types

Consumes: text/ini, text/x-ini

Value parsing
  • Unquoted null → Java null
  • Unquoted true/false → Boolean
  • Unquoted numbers → Number (int, long, float, double as appropriate)
  • Single-quoted strings ('...') → String (with '' unescaped to single quote)
  • Values starting with [ or { → Delegated to JSON parser
  • ISO 8601 strings → Date, Calendar, or java.time.* when target requires it
  • ISO 8601 duration strings → Duration
  • Other unquoted tokens → String
Sections

Sections (e.g. [address]) map to nested bean properties or Map properties. Section paths like [employment/company] map to deeply nested bean properties.

Example:

// Parse INI into a bean MyConfig config = IniParser.DEFAULT.read(ini, MyConfig.class); // Parse into a Map Map<String, Object> map = IniParser.DEFAULT.read(ini, Map.class, String.class, Object.class);

Example input:

name = Alice age = 30 [address] street = 123 Main St city = Boston state = MA

Limitations

Parsing into top-level collections, arrays, or scalar types is not supported. The target type must be a bean class or Map<String,?>.

Notes:
  • This class is thread safe and reusable.
  • Values starting with [ or { are delegated to the JSON parser.
See Also: