Skip to main content

Convert INI to Java .properties — flatten sections into dotted keys

Free CLI to convert INI configuration files into Java .properties resources. Flattens [section] headers into dotted prefixes, drops comments, preserves values.

Free CLI — convert ini files to java-properties:

npm install -g @i18n-agent/i18n-convert
Need to translate, not just convert? Try i18nagent.ai MCP →

INI is a configuration format with sectional organization — [general], [messages], [ui] — and Java .properties is a flat key-value file with no native concept of sections at all. The convention for bridging the two is well established: each INI section header becomes a dotted prefix on its enclosed keys. So [general] greeting=Hello becomes general.greeting=Hello in the Properties file. This is the same convention that commons-configuration2 uses when round-tripping the same content between the two formats, and it is what most Java tooling implicitly expects.

i18n-convert reads the INI file, walks each section in document order, and emits a Properties file in which every leaf key carries its enclosing section name as a dotted prefix. Keys that already contain dots inside a section (such as error.not_found under [messages]) get the section prefix prepended to produce the full path (messages.error.not_found). Section-level comments (lines starting with ; or #) are not carried over because Properties' single-line # comment grammar would re-introduce ambiguity about which key they belong to; the entries themselves are preserved in input order so that adjacent entries in the INI remain adjacent in the output. Whitespace around = is normalized to a single space on each side, matching the Properties convention emitted by every standard JVM tool.

Command

i18n-convert simple.ini --to java-properties -o messages.properties

Input

; Application settings

[general]
greeting = Hello, World!
farewell = Goodbye!

[messages]
welcome = Welcome to our app
error.not_found = Page not found

Output

general.greeting = Hello, World!

general.farewell = Goodbye!

messages.welcome = Welcome to our app

messages.error.not_found = Page not found

Related conversions