<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>hocon</title>
  <link href="https://hocon.edadma.dev/feed.xml" rel="self"/>
  <link href="https://hocon.edadma.dev/"/>
  <id>https://hocon.edadma.dev/feed.xml</id>
  <updated>2026-06-08T11:57:37.800272439Z</updated>
  <author><name>Ed Maxedon</name></author>
  <entry>
    <title>Substitutions</title>
    <link href="https://hocon.edadma.dev/guide/substitutions/"/>
    <id>https://hocon.edadma.dev/guide/substitutions/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>A substitution lets one value reference another, so you write a setting once and reuse it. hocon resolves substitutions automatically when you call Hocon.parse — the config you get back…</summary>
    <content type="html">&lt;p&gt;A substitution lets one value reference another, so you write a setting once and reuse it. hocon
resolves substitutions automatically when you call &lt;code&gt;Hocon.parse&lt;/code&gt; — the config you get back has none
left in it.&lt;/p&gt;
&lt;h2 id=&quot;the-two-forms&quot;&gt;The two forms&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;${path}&lt;/code&gt; is a &lt;strong&gt;required&lt;/strong&gt; substitution: it must resolve to something, or parsing fails.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  host = localhost&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  url  = ${host}&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;${?path}&lt;/code&gt; is &lt;strong&gt;optional&lt;/strong&gt;: if it resolves to nothing, the field that holds it simply does not appear.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  a = 1&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  b = ${?not-set}&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hasPath&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// false&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;resolution-rules&quot;&gt;Resolution rules&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Substitutions resolve against the merged root&lt;/strong&gt;, so they are order-independent — a value may
reference a key defined later in the document.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A path may point anywhere&lt;/strong&gt;, including into nested objects (&lt;code&gt;${server.host}&lt;/code&gt;), and may copy a
whole object or array, not just a scalar.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chains resolve transitively&lt;/strong&gt; — &lt;code&gt;a = ${b}&lt;/code&gt;, &lt;code&gt;b = ${c}&lt;/code&gt;, &lt;code&gt;c = 1&lt;/code&gt; makes &lt;code&gt;a&lt;/code&gt; equal &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  defaults { timeout = 30, retries = 3 }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  service  = ${defaults}        # copies the whole object&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  primary  = ${service.timeout} # 30&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;environment-fallback&quot;&gt;Environment fallback&lt;/h2&gt;
&lt;p&gt;A substitution that is not found in the config falls back to an &lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;EnvSource&lt;/code&gt;&lt;/a&gt;.
The default environment is empty (the core stays pure and platform-independent); pass one to
&lt;code&gt;Hocon.parse&lt;/code&gt; to wire in the real environment or a fixed map:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; env &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;EnvSource&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;fromMap&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-type&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;HOME&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;/home/ada&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;home = ${HOME}&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; env&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;/home/ada&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Config values always win over the environment — the environment is only consulted when the path is
absent from the document.&lt;/p&gt;
&lt;div class=&quot;juicer-callout juicer-callout-note&quot;&gt;
  &lt;strong&gt;Note&lt;/strong&gt;
  &lt;div class=&quot;juicer-callout-body&quot;&gt;&lt;p&gt;Config values take precedence over the environment, and a required &lt;code&gt;${path}&lt;/code&gt; found in neither raises
&lt;code&gt;UnresolvedSubstitutionException&lt;/code&gt;. To make a substitution that may be absent, use the optional
&lt;code&gt;${?path}&lt;/code&gt; form.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;cycles&quot;&gt;Cycles&lt;/h2&gt;
&lt;p&gt;A reference chain that closes on itself — including a value that references itself with no prior
definition — raises &lt;code&gt;CircularReferenceException&lt;/code&gt;, with the chain in the message:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  a = ${b}&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  b = ${a}&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hl-comment&quot;&gt;// CircularReferenceException: Circular reference in substitution: a -&amp;gt; b -&amp;gt; a&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;concatenating-with-surrounding-text&quot;&gt;Concatenating with surrounding text&lt;/h2&gt;
&lt;p&gt;A substitution may also be one piece of a larger value. Written with whitespace next to other
text, it joins into a single string — this is &lt;a href=&quot;/guide/format/#value-concatenation&quot;&gt;value concatenation&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  host = example.com&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  port = 8080&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  url  = &amp;quot;http://&amp;quot;${host}&amp;quot;:&amp;quot;${port}&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;http://example.com:8080&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pieces resolve and then concatenate, so a substitution can sit inside a URL, a path, or any
other composed string.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>Roadmap</title>
    <link href="https://hocon.edadma.dev/guide/roadmap/"/>
    <id>https://hocon.edadma.dev/guide/roadmap/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>hocon is built in phases, smallest-useful-thing first. The goal of the early phases is a parser good enough to write and read i18n translation files; later phases close the gap…</summary>
    <content type="html">&lt;p&gt;hocon is built in phases, smallest-useful-thing first. The goal of the early phases is a
parser good enough to write and read i18n translation files; later phases close the gap to
the full HOCON specification, with the reference implementation’s conformance corpus as the
eventual oracle.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th align=&quot;right&quot;&gt;Phase&lt;/th&gt;&lt;th&gt;Scope&lt;/th&gt;&lt;th align=&quot;center&quot;&gt;Status&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Lexer + parser → untyped &lt;code&gt;Config&lt;/code&gt; (comments, quoted/unquoted strings, nested objects, path-expression keys, arrays).&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;✅ Done&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Object merging + &lt;code&gt;withFallback&lt;/code&gt; (base locale + overrides).&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;✅ Done&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Substitutions: &lt;code&gt;${path}&lt;/code&gt;, &lt;code&gt;${?path}&lt;/code&gt;, environment fallback, cycle detection.&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;✅ Done&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Value concatenation + durations (&lt;code&gt;10s&lt;/code&gt;) and sizes (&lt;code&gt;512K&lt;/code&gt;, &lt;code&gt;10MB&lt;/code&gt;).&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;✅ Done&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;include&lt;/code&gt; directives behind a pluggable, per-platform IO source.&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Planned&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;6&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Typed decoder with case-class derivation (&lt;code&gt;config.as[A]&lt;/code&gt;).&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Planned&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;7&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Conformance against the reference test corpus.&lt;/td&gt;&lt;td align=&quot;center&quot;&gt;Planned&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;design-notes&quot;&gt;Design notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cross-platform from the first commit.&lt;/strong&gt; The lexer, parser, and &lt;code&gt;Config&lt;/code&gt; API are pure
Scala in a shared source set; every test runs identically on the JVM, Scala.js, and Scala
Native. IO and environment access — needed for &lt;code&gt;include&lt;/code&gt; and substitution fallback — will
live behind a small capability seam with per-platform implementations, so the core never
touches a filesystem.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Untyped core first, typed decoder later.&lt;/strong&gt; The &lt;code&gt;Config&lt;/code&gt; tree and its getters are the
foundation; the case-class decoder (&lt;code&gt;config.as[A]&lt;/code&gt;) layers on top once the value model is
complete, mirroring how the typed and untyped layers separate elsewhere.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spec-correct, not convenient.&lt;/strong&gt; Where the HOCON spec and a nicer-for-i18n shortcut
disagree — most visibly the forbidden characters in unquoted strings — hocon follows the
spec and asks you to quote, so the same files will validate against the conformance corpus
in Phase 7.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>
  <entry>
    <title>Quick Start</title>
    <link href="https://hocon.edadma.dev/getting-started/quick-start/"/>
    <id>https://hocon.edadma.dev/getting-started/quick-start/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>Parse a HOCON document, read typed values out of it, and use it for i18n messages.</summary>
    <content type="html">&lt;p&gt;Parse a HOCON document, read typed values out of it, and use it for i18n messages.&lt;/p&gt;
&lt;h2 id=&quot;parse-and-read&quot;&gt;Parse and read&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;Hocon.parse&lt;/code&gt; turns a string of HOCON into an immutable &lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/a&gt;. Read
values with typed getters; paths are dot-separated.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;import&lt;/span&gt; io&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;github&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;edadma&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hocon&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-keyword&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  app {&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;    name = &amp;quot;Roamer&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;    window { width = 1024, height = 768 }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;    recent-files = [&amp;quot;a.txt&amp;quot;, &amp;quot;b.txt&amp;quot;]&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;    telemetry = false&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.name&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;              &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Roamer&amp;quot;&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.window.width&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;hl-comment&quot;&gt;// 1024&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getBoolean&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.telemetry&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;hl-comment&quot;&gt;// false&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getStringList&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.recent-files&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// List(&amp;quot;a.txt&amp;quot;, &amp;quot;b.txt&amp;quot;)&lt;/span&gt;

&lt;span class=&quot;hl-comment&quot;&gt;// Drill into a sub-tree:&lt;/span&gt;
&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; window &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getConfig&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.window&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
window&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;height&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;                   &lt;span class=&quot;hl-comment&quot;&gt;// 768&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A missing path throws &lt;code&gt;MissingPathException&lt;/code&gt;; a value of the wrong shape throws
&lt;code&gt;WrongTypeException&lt;/code&gt;. When a key may be absent, use &lt;code&gt;hasPath&lt;/code&gt; or the &lt;code&gt;*Opt&lt;/code&gt; variants:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hasPath&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.theme&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;               &lt;span class=&quot;hl-comment&quot;&gt;// false&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getStringOpt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.theme&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;          &lt;span class=&quot;hl-comment&quot;&gt;// None&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getIntOpt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;app.window.width&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;hl-comment&quot;&gt;// Some(1024)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;a-note-on-quoting&quot;&gt;A note on quoting&lt;/h2&gt;
&lt;p&gt;HOCON lets you write unquoted strings, but it &lt;strong&gt;forbids&lt;/strong&gt; these characters inside them:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ &amp;quot; { } [ ] : = , + # ` ^ ? ! @ * &amp;amp; \
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Most real UI strings — &lt;code&gt;Hello, world&lt;/code&gt;, &lt;code&gt;Are you sure?&lt;/code&gt;, &lt;code&gt;{count} items&lt;/code&gt; — contain one of
them, so &lt;strong&gt;quote your translation strings&lt;/strong&gt;. This is spec-correct HOCON, not a limitation of
this library; bare words are fine for identifiers, numbers, and simple paths.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;name      = roamer            # fine — a bare identifier
greeting  = &amp;quot;Hello, world&amp;quot;    # must be quoted — contains a comma
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;i18n-messages&quot;&gt;i18n messages&lt;/h2&gt;
&lt;p&gt;HOCON’s nesting and comments make it a comfortable format for translation files. The
&lt;code&gt;Messages&lt;/code&gt; helper looks a string up by path and fills &lt;code&gt;{name}&lt;/code&gt; placeholders:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; en &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting   = &amp;quot;Hello, {name}&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  cart.items = &amp;quot;{count} items in your cart&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; m &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Messages&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;en&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;Ada&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Hello, Ada&amp;quot;&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;cart.items&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;count&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;3 items in your cart&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A placeholder with no matching argument is left untouched, so a missing value is visible
rather than silently dropped.&lt;/p&gt;
&lt;h2 id=&quot;base-locale-with-overrides&quot;&gt;Base locale with overrides&lt;/h2&gt;
&lt;p&gt;Keep one complete base locale and let each translation override only what it changes. Merge
with &lt;code&gt;withFallback&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; base &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting = &amp;quot;Hello&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  farewell = &amp;quot;Goodbye&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  nav { home = &amp;quot;Home&amp;quot;, about = &amp;quot;About&amp;quot; }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; fr &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting = &amp;quot;Bonjour&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  nav { home = &amp;quot;Accueil&amp;quot; }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; m &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Messages&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;fr&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;withFallback&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;base&lt;span class=&quot;hl-punctuation&quot;&gt;))&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Bonjour&amp;quot;   (translated)&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;farewell&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Goodbye&amp;quot;   (from base)&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;nav.home&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Accueil&amp;quot;   (translated)&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;nav.about&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;About&amp;quot;     (from base)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See the &lt;a href=&quot;/guide/merging/&quot;&gt;merging guide&lt;/a&gt; for the full rules, and the
&lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;Config&lt;/code&gt; reference&lt;/a&gt; for every getter.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>Messages</title>
    <link href="https://hocon.edadma.dev/reference/messages/"/>
    <id>https://hocon.edadma.dev/reference/messages/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>Messages is a thin i18n helper over a Config of translation strings. It looks messages up by path and fills {name} placeholders from named arguments. It is a convenience layer…</summary>
    <content type="html">&lt;p&gt;&lt;code&gt;Messages&lt;/code&gt; is a thin i18n helper over a &lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/a&gt; of translation
strings. It looks messages up by path and fills &lt;code&gt;{name}&lt;/code&gt; placeholders from named arguments.
It is a convenience layer — the config it reads is ordinary HOCON.&lt;/p&gt;
&lt;h2 id=&quot;constructing&quot;&gt;Constructing&lt;/h2&gt;
&lt;p&gt;Wrap any &lt;code&gt;Config&lt;/code&gt; whose values are the message strings:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;import&lt;/span&gt; io&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;github&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;edadma&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hocon&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-keyword&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; en &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting   = &amp;quot;Hello, {name}&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  cart.items = &amp;quot;{count} items in your cart&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  plain      = &amp;quot;No placeholders here&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; m &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Messages&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;en&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a base locale with per-language overrides, merge first with
&lt;a href=&quot;/guide/merging/&quot;&gt;&lt;code&gt;withFallback&lt;/code&gt;&lt;/a&gt; and wrap the result:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; m &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Messages&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;fr&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;withFallback&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;base&lt;span class=&quot;hl-punctuation&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;methods&quot;&gt;Methods&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Returns&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;apply(path, args: (String, Any)*)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Look up &lt;code&gt;path&lt;/code&gt; and substitute &lt;code&gt;{name}&lt;/code&gt; placeholders from &lt;code&gt;args&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;get(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Look up &lt;code&gt;path&lt;/code&gt; with no substitution.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;hasPath(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Boolean&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Whether the underlying config has a value at &lt;code&gt;path&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;Ada&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Hello, Ada&amp;quot;&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;cart.items&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;count&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;3 items in your cart&amp;quot;&lt;/span&gt;
m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;plain&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;                       &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;No placeholders here&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;behavior&quot;&gt;Behavior&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Placeholders are &lt;code&gt;{name}&lt;/code&gt; where the name is letters, digits, or underscores.&lt;/li&gt;
&lt;li&gt;Argument values are converted with &lt;code&gt;toString&lt;/code&gt;, so numbers, booleans, and any type work.&lt;/li&gt;
&lt;li&gt;A placeholder with &lt;strong&gt;no matching argument is left untouched&lt;/strong&gt;, so a missing value shows up
in the output rather than disappearing silently:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;m&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;other&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Hello, {name}&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;A missing message path throws &lt;code&gt;MissingPathException&lt;/code&gt;, like any other &lt;code&gt;Config&lt;/code&gt; lookup.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>
  <entry>
    <title>Merging and fallback</title>
    <link href="https://hocon.edadma.dev/guide/merging/"/>
    <id>https://hocon.edadma.dev/guide/merging/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>Real configuration is layered: a base with environment overrides, a default locale with per-language translations, library defaults beneath application settings. hocon expresses that with fallback — one config supplying defaults…</summary>
    <content type="html">&lt;p&gt;Real configuration is layered: a base with environment overrides, a default locale with
per-language translations, library defaults beneath application settings. hocon expresses
that with &lt;strong&gt;fallback&lt;/strong&gt; — one config supplying defaults for another.&lt;/p&gt;
&lt;h2 id=&quot;withfallback&quot;&gt;withFallback&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;a.withFallback(b)&lt;/code&gt; returns a new config where &lt;code&gt;a&lt;/code&gt; wins and &lt;code&gt;b&lt;/code&gt; fills in whatever &lt;code&gt;a&lt;/code&gt; does
not set:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; base     &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;a = 1, b = base&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; override_ &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b = over, c = 3&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; merged &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; override_&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;withFallback&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;base&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;hl-comment&quot;&gt;// 1      — only in base&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;over&amp;quot; — override wins&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;     &lt;span class=&quot;hl-comment&quot;&gt;// 3      — only in override&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;how-merging-works&quot;&gt;How merging works&lt;/h2&gt;
&lt;p&gt;The merge is recursive, and the rule is the same at every level:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Objects present on both sides merge recursively.&lt;/strong&gt; Their keys are unioned; shared keys
follow these same rules one level down.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scalars and arrays replace.&lt;/strong&gt; The winning side’s value is taken whole — arrays are &lt;em&gt;not&lt;/em&gt;
concatenated or element-merged.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A &lt;code&gt;null&lt;/code&gt; on the winning side shadows the fallback.&lt;/strong&gt; Because &lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;hasPath&lt;/code&gt;&lt;/a&gt;
treats &lt;code&gt;null&lt;/code&gt; as absent, a &lt;code&gt;null&lt;/code&gt; override effectively &lt;em&gt;unsets&lt;/em&gt; a key the fallback defined.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; base &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  server { host = localhost, port = 80, tags = [a, b] }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; over &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  server { port = 9000, tags = [c] }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; merged &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; over&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;withFallback&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;base&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getString&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;server.host&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;localhost&amp;quot;  — kept from base&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;server.port&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;hl-comment&quot;&gt;// 9000         — overridden&lt;/span&gt;
merged&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getStringList&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;server.tags&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// List(&amp;quot;c&amp;quot;)    — arrays replace, not concat&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;layering-several-configs&quot;&gt;Layering several configs&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;Hocon.load&lt;/code&gt; merges any number of configs so that &lt;strong&gt;later arguments win&lt;/strong&gt; — pass the base
first and the most specific overrides last:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; effective &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;load&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;
  libraryDefaults&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// weakest&lt;/span&gt;
  applicationConfig&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt;
  userOverrides&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt;     &lt;span class=&quot;hl-comment&quot;&gt;// strongest&lt;/span&gt;
&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With no arguments it returns the empty config.&lt;/p&gt;
&lt;h2 id=&quot;base-locale-with-overrides&quot;&gt;Base locale with overrides&lt;/h2&gt;
&lt;p&gt;This is the i18n pattern: keep one complete base locale, and let each translation override
only the strings it changes. Anything a translation omits falls through to the base, so the
UI is never missing a string.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; base &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting = &amp;quot;Hello&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  farewell = &amp;quot;Goodbye&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  nav { home = &amp;quot;Home&amp;quot;, about = &amp;quot;About&amp;quot; }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; fr &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  greeting = &amp;quot;Bonjour&amp;quot;&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;  nav { home = &amp;quot;Accueil&amp;quot; }&lt;/span&gt;
&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; messages &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Messages&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;fr&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;withFallback&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;base&lt;span class=&quot;hl-punctuation&quot;&gt;))&lt;/span&gt;
messages&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;greeting&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Bonjour&amp;quot;   (translated)&lt;/span&gt;
messages&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;farewell&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Goodbye&amp;quot;   (from base)&lt;/span&gt;
messages&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;nav.home&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;Accueil&amp;quot;   (translated)&lt;/span&gt;
messages&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;nav.about&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// &amp;quot;About&amp;quot;     (from base)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
  </entry>
  <entry>
    <title>Installation</title>
    <link href="https://hocon.edadma.dev/getting-started/installation/"/>
    <id>https://hocon.edadma.dev/getting-started/installation/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>hocon is a pure-Scala library with no native dependencies, so there is nothing to install at the system level — just add it to your build.</summary>
    <content type="html">&lt;p&gt;hocon is a pure-Scala library with no native dependencies, so there is nothing to install at
the system level — just add it to your build.&lt;/p&gt;
&lt;div class=&quot;juicer-callout juicer-callout-note&quot;&gt;
  &lt;strong&gt;Note&lt;/strong&gt;
  &lt;div class=&quot;juicer-callout-body&quot;&gt;&lt;p&gt;hocon is under active development. The parser, the untyped &lt;code&gt;Config&lt;/code&gt; API, object merging,
substitutions, value concatenation, and durations/sizes are in place and tested on all three
platforms; &lt;code&gt;include&lt;/code&gt; directives and a typed decoder are on the &lt;a href=&quot;/guide/roadmap/&quot;&gt;roadmap&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Scala 3&lt;/li&gt;
&lt;li&gt;sbt&lt;/li&gt;
&lt;li&gt;For Scala.js / Scala Native targets: the usual &lt;code&gt;sbt-scalajs&lt;/code&gt; / &lt;code&gt;sbt-scala-native&lt;/code&gt; plugins&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;No &lt;code&gt;java.*&lt;/code&gt; dependency is used in the core, and there are no native libraries to link.&lt;/p&gt;
&lt;h2 id=&quot;add-the-dependency&quot;&gt;Add the dependency&lt;/h2&gt;
&lt;p&gt;hocon cross-publishes for the JVM, Scala.js, and Scala Native. Use the &lt;code&gt;%%%&lt;/code&gt; operator so sbt
picks the right artifact for each platform:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;libraryDependencies &lt;span class=&quot;hl-keyword&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;io.github.edadma&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;%%%&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;hocon&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;0.0.1&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In a &lt;code&gt;crossProject&lt;/code&gt; build the single line covers every target:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;lazy&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; app &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; crossProject&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-type&quot;&gt;JVMPlatform&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;JSPlatform&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;NativePlatform&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;settings&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;
    libraryDependencies &lt;span class=&quot;hl-keyword&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;io.github.edadma&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;%%%&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;hocon&amp;quot;&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;0.0.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;from-source&quot;&gt;From source&lt;/h2&gt;
&lt;p&gt;To track the latest changes, you can depend on hocon as a source dependency instead. Clone it
next to your project:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;hl-function&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;hl-function&quot;&gt;clone&lt;/span&gt; &lt;span class=&quot;hl-function&quot;&gt;https://github.com/edadma/hocon.git&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and reference the cross-built module by relative path in your &lt;code&gt;build.sbt&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;dependsOn&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-type&quot;&gt;ProjectRef&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;file&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;../hocon&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;hl-string&quot;&gt;&amp;quot;hocon&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;verify-the-setup&quot;&gt;Verify the setup&lt;/h2&gt;
&lt;p&gt;hocon’s own suite is pure Scala and runs headlessly on every platform:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;hl-function&quot;&gt;sbt&lt;/span&gt; &lt;span class=&quot;hl-function&quot;&gt;hoconJVM/test&lt;/span&gt;
&lt;span class=&quot;hl-function&quot;&gt;sbt&lt;/span&gt; &lt;span class=&quot;hl-function&quot;&gt;hoconJS/test&lt;/span&gt;
&lt;span class=&quot;hl-function&quot;&gt;sbt&lt;/span&gt; &lt;span class=&quot;hl-function&quot;&gt;hoconNative/test&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All three run the identical tests — that cross-platform parity is the whole point of the
library. Continue to the &lt;a href=&quot;/getting-started/quick-start/&quot;&gt;quick start&lt;/a&gt; to parse a config.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>The HOCON format</title>
    <link href="https://hocon.edadma.dev/guide/format/"/>
    <id>https://hocon.edadma.dev/guide/format/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>HOCON is a superset of JSON: every JSON document is valid HOCON, but HOCON adds comments, optional quoting, optional commas, and a handful of conveniences that make hand-written config pleasant.…</summary>
    <content type="html">&lt;p&gt;HOCON is a superset of JSON: every JSON document is valid HOCON, but HOCON adds comments,
optional quoting, optional commas, and a handful of conveniences that make hand-written
config pleasant. This page covers the syntax hocon parses today.&lt;/p&gt;
&lt;h2 id=&quot;objects-and-fields&quot;&gt;Objects and fields&lt;/h2&gt;
&lt;p&gt;The top-level braces are optional, and a field is a key, a separator (&lt;code&gt;=&lt;/code&gt; or &lt;code&gt;:&lt;/code&gt;), and a
value:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;name = &amp;quot;Roamer&amp;quot;
version : &amp;quot;1.0&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;=&lt;/code&gt; and &lt;code&gt;:&lt;/code&gt; are interchangeable. Fields are separated by a newline &lt;strong&gt;or&lt;/strong&gt; a comma; a trailing
comma is allowed:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;a = 1, b = 2
c = 3
xs = [1, 2, 3,]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When a value is an object, the separator may be omitted entirely:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;window {
  width  = 1024
  height = 768
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;comments&quot;&gt;Comments&lt;/h2&gt;
&lt;p&gt;Both &lt;code&gt;#&lt;/code&gt; and &lt;code&gt;//&lt;/code&gt; start a comment that runs to the end of the line:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;# a full-line comment
port = 8080   // a trailing comment
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;values&quot;&gt;Values&lt;/h2&gt;
&lt;p&gt;hocon recognizes the JSON value types plus unquoted strings:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;string  = &amp;quot;quoted text&amp;quot;
bare    = an-unquoted-string
number  = 8080
float   = 1.5
flag    = true
empty   = null
list    = [1, &amp;quot;two&amp;quot;, true]
nested  = { a = 1, b = 2 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt;, and &lt;code&gt;null&lt;/code&gt; are keywords; anything matching a number literal is a number;
everything else is a string.&lt;/p&gt;
&lt;h3 id=&quot;quoting&quot;&gt;Quoting&lt;/h3&gt;
&lt;div class=&quot;juicer-callout juicer-callout-note&quot;&gt;
  &lt;strong&gt;Note&lt;/strong&gt;
  &lt;div class=&quot;juicer-callout-body&quot;&gt;&lt;p&gt;HOCON allows unquoted strings, but &lt;strong&gt;forbids&lt;/strong&gt; these characters inside them:
&lt;code&gt;$ &amp;quot; { } [ ] : = , + # &lt;/code&gt; ^ ? ! @ * &amp;amp; `. Most natural-language strings hit one of them, so
quote your message strings. hocon raises a parse error pointing at the offending character
rather than guessing — this is spec-correct behavior.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Bare words are convenient for identifiers, numeric values, and simple paths
(&lt;code&gt;localhost&lt;/code&gt;, &lt;code&gt;recent-files&lt;/code&gt;, &lt;code&gt;8080&lt;/code&gt;). For anything with punctuation, quote it.&lt;/p&gt;
&lt;h3 id=&quot;string-escapes&quot;&gt;String escapes&lt;/h3&gt;
&lt;p&gt;Quoted strings support the JSON escapes — &lt;code&gt;\&amp;quot;&lt;/code&gt;, &lt;code&gt;\\&lt;/code&gt;, &lt;code&gt;\/&lt;/code&gt;, &lt;code&gt;\n&lt;/code&gt;, &lt;code&gt;\t&lt;/code&gt;, &lt;code&gt;\r&lt;/code&gt;, &lt;code&gt;\b&lt;/code&gt;, &lt;code&gt;\f&lt;/code&gt;, and
&lt;code&gt;\uXXXX&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;path    = &amp;quot;C:\\Users\\Ada&amp;quot;
caption = &amp;quot;line one\nline two&amp;quot;
heart   = &amp;quot;❤&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Triple-quoted strings are &lt;strong&gt;raw&lt;/strong&gt; — no escapes are processed and newlines are kept verbatim,
which is handy for embedded text:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;banner = &amp;quot;&amp;quot;&amp;quot;
  Welcome to Roamer.
  Press ? for help.
&amp;quot;&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;path-expression-keys&quot;&gt;Path-expression keys&lt;/h2&gt;
&lt;p&gt;A key may be a dotted path, which expands into nested objects. These two documents are
equivalent:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;a.b.c = value
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;a { b { c = value } }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Keys that target the same object merge, so you can group related settings flatly:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;cart.items   = &amp;quot;{count} items&amp;quot;
cart.empty   = &amp;quot;Your cart is empty&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;resolves to a &lt;code&gt;cart&lt;/code&gt; object with both &lt;code&gt;items&lt;/code&gt; and &lt;code&gt;empty&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;arrays&quot;&gt;Arrays&lt;/h2&gt;
&lt;p&gt;Array elements are separated by commas or newlines, with an optional trailing comma, and may
be any value type — including objects and nested arrays:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;ports = [
  8080
  8081
  8082,
]

users = [
  { name = &amp;quot;Ada&amp;quot;,  admin = true  },
  { name = &amp;quot;Alan&amp;quot;, admin = false },
]
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;substitutions&quot;&gt;Substitutions&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;${path}&lt;/code&gt; references another value, and &lt;code&gt;${?path}&lt;/code&gt; is its optional form. They resolve against
the merged document, so they are order-independent:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;host = localhost
url  = ${host}        # → &amp;quot;localhost&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See the &lt;a href=&quot;/guide/substitutions/&quot;&gt;substitutions guide&lt;/a&gt; for the full rules — environment
fallback, object copying, and cycle detection.&lt;/p&gt;
&lt;h2 id=&quot;value-concatenation&quot;&gt;Value concatenation&lt;/h2&gt;
&lt;p&gt;Several pieces written on one line with only whitespace between them concatenate into a single
value. Strings, numbers, booleans, and substitutions join into one string, with the interior
whitespace preserved and the ends trimmed:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;host = example.com
port = 8080
url  = &amp;quot;http://&amp;quot;${host}&amp;quot;:&amp;quot;${port}   # → &amp;quot;http://example.com:8080&amp;quot;
full = first   middle  last         # → &amp;quot;first   middle  last&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Arrays concatenate element-wise, and objects deep-merge left to right:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;xs   = [1, 2] [3, 4]                 # → [1, 2, 3, 4]
conf = ${defaults} { retries = 5 }   # the defaults object with retries overridden
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Mixing kinds that cannot combine — an object or array joined with a string — raises a
&lt;code&gt;HoconConcatException&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;durations-and-sizes&quot;&gt;Durations and sizes&lt;/h2&gt;
&lt;p&gt;A value can be read as a time duration or a memory size with the dedicated getters; in the
source it is just a number with a unit suffix (an optional space is allowed):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-hocon&quot;&gt;timeout   = 10s
poll      = 500ms
linger    = 5 minutes
cache     = 512K
max-upload = 10MB
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;getDuration&lt;/code&gt; returns a cross-platform &lt;code&gt;FiniteDuration&lt;/code&gt;; &lt;code&gt;getBytes&lt;/code&gt; returns a &lt;code&gt;Long&lt;/code&gt;. Duration
units are &lt;code&gt;ns&lt;/code&gt;, &lt;code&gt;us&lt;/code&gt;, &lt;code&gt;ms&lt;/code&gt;, &lt;code&gt;s&lt;/code&gt;, &lt;code&gt;m&lt;/code&gt;, &lt;code&gt;h&lt;/code&gt;, &lt;code&gt;d&lt;/code&gt; (and their long spellings), with a bare number
read as milliseconds. Size units distinguish powers of 1024 (&lt;code&gt;K&lt;/code&gt;, &lt;code&gt;Ki&lt;/code&gt;, &lt;code&gt;KiB&lt;/code&gt;, …) from powers of
1000 (&lt;code&gt;kB&lt;/code&gt;, &lt;code&gt;MB&lt;/code&gt;, …), with a bare number read as bytes. See the
&lt;a href=&quot;/reference/config/&quot;&gt;&lt;code&gt;Config&lt;/code&gt; reference&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;not-yet-supported&quot;&gt;Not yet supported&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;include&lt;/code&gt; directives — pulling in other files — are on the &lt;a href=&quot;/guide/roadmap/&quot;&gt;roadmap&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Because unquoted strings forbid &lt;code&gt;:&lt;/code&gt; and &lt;code&gt;//&lt;/code&gt; starts a comment, &lt;strong&gt;URLs must be quoted&lt;/strong&gt;
(&lt;code&gt;url = &amp;quot;https://example.com&amp;quot;&lt;/code&gt;) — this matches the reference implementation.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>Config</title>
    <link href="https://hocon.edadma.dev/reference/config/"/>
    <id>https://hocon.edadma.dev/reference/config/</id>
    <updated>2026-06-08T11:57:37.800272439Z</updated>
    <summary>Config is an immutable, untyped view over a parsed HOCON document. You obtain one from Hocon.parse, navigate it by dot-separated path, and read typed values with the getters below.</summary>
    <content type="html">&lt;p&gt;&lt;code&gt;Config&lt;/code&gt; is an immutable, untyped view over a parsed HOCON document. You obtain one from
&lt;code&gt;Hocon.parse&lt;/code&gt;, navigate it by dot-separated path, and read typed values with the getters
below.&lt;/p&gt;
&lt;h2 id=&quot;parsing-and-combining&quot;&gt;Parsing and combining&lt;/h2&gt;
&lt;p&gt;These live on the &lt;code&gt;Hocon&lt;/code&gt; object.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Returns&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Hocon.parse(input: String)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Parse HOCON source and resolve &lt;code&gt;${...}&lt;/code&gt; substitutions. Throws &lt;code&gt;ParseError&lt;/code&gt; on a syntax error.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Hocon.parse(input: String, env: EnvSource)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/td&gt;&lt;td&gt;As above, falling back to &lt;code&gt;env&lt;/code&gt; for substitutions absent from the document.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Hocon.load(configs: Config*)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Merge configs so that &lt;strong&gt;later arguments win&lt;/strong&gt;. No arguments → the empty config.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;code&gt;EnvSource&lt;/code&gt; is the seam substitutions use for environment fallback. The default is
&lt;code&gt;EnvSource.empty&lt;/code&gt;; build one from a map with &lt;code&gt;EnvSource.fromMap(...)&lt;/code&gt;, or implement the
single-method trait to wire in the real environment. See the
&lt;a href=&quot;/guide/substitutions/&quot;&gt;substitutions guide&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;import&lt;/span&gt; io&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;github&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;edadma&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hocon&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-keyword&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; config &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;a = 1, b { c = 2 }&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;reading-values&quot;&gt;Reading values&lt;/h2&gt;
&lt;p&gt;Paths are dot-separated (&lt;code&gt;a.b.c&lt;/code&gt;). Each getter throws &lt;code&gt;MissingPathException&lt;/code&gt; when the path is
absent or &lt;code&gt;null&lt;/code&gt;, and &lt;code&gt;WrongTypeException&lt;/code&gt; when the value is the wrong shape.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Returns&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getString(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Numbers and booleans are returned as their text.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getInt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Int&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Parses the numeric literal.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getLong(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Long&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getDouble(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Double&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getBoolean(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Boolean&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Also accepts the strings &lt;code&gt;yes&lt;/code&gt;/&lt;code&gt;no&lt;/code&gt;/&lt;code&gt;on&lt;/code&gt;/&lt;code&gt;off&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getConfig(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The sub-object at &lt;code&gt;path&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getList(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;List[ConfigValue]&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The raw array elements.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getStringList(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;List[String]&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Each element coerced to string.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getDuration(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;FiniteDuration&lt;/code&gt;&lt;/td&gt;&lt;td&gt;A HOCON duration (&lt;code&gt;10s&lt;/code&gt;, &lt;code&gt;5 minutes&lt;/code&gt;); a bare number is milliseconds.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getBytes(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Long&lt;/code&gt;&lt;/td&gt;&lt;td&gt;A HOCON size in bytes (&lt;code&gt;512K&lt;/code&gt;, &lt;code&gt;10MB&lt;/code&gt;); powers of 1024 and 1000 are distinguished.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getValue(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;ConfigValue&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The raw value node, whatever its type.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;          &lt;span class=&quot;hl-comment&quot;&gt;// 1&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b.c&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;hl-comment&quot;&gt;// 2&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getConfig&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;).&lt;/span&gt;getInt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// 2&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;durations-and-sizes&quot;&gt;Durations and sizes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;getDuration&lt;/code&gt; reads a HOCON time value into a cross-platform
&lt;code&gt;scala.concurrent.duration.FiniteDuration&lt;/code&gt;. Units are &lt;code&gt;ns&lt;/code&gt;, &lt;code&gt;us&lt;/code&gt;, &lt;code&gt;ms&lt;/code&gt;, &lt;code&gt;s&lt;/code&gt;, &lt;code&gt;m&lt;/code&gt;, &lt;code&gt;h&lt;/code&gt;, &lt;code&gt;d&lt;/code&gt; and
their long spellings; a number with no unit is read as milliseconds.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;getBytes&lt;/code&gt; reads a HOCON memory size into a &lt;code&gt;Long&lt;/code&gt; count of bytes. Powers-of-1024 units (&lt;code&gt;K&lt;/code&gt;,
&lt;code&gt;Ki&lt;/code&gt;, &lt;code&gt;KiB&lt;/code&gt;, …) and powers-of-1000 units (&lt;code&gt;kB&lt;/code&gt;, &lt;code&gt;MB&lt;/code&gt;, …) are distinguished per the spec; a bare
number is a byte count, and a fractional quantity truncates.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;&lt;span class=&quot;hl-keyword&quot;&gt;val&lt;/span&gt; c &lt;span class=&quot;hl-keyword&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;hl-type&quot;&gt;Hocon&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;timeout = 30s, cache = 512K&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;
c&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getDuration&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;timeout&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;    &lt;span class=&quot;hl-comment&quot;&gt;// 30.seconds&lt;/span&gt;
c&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getBytes&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;cache&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;         &lt;span class=&quot;hl-comment&quot;&gt;// 524288&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;optional-access&quot;&gt;Optional access&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;hasPath&lt;/code&gt; reports whether a path resolves to a present, non-null value. Each getter has an
&lt;code&gt;*Opt&lt;/code&gt; variant that returns &lt;code&gt;None&lt;/code&gt; instead of throwing on a missing path:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Returns&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;hasPath(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Boolean&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getStringOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[String]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getIntOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Int]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getLongOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Long]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getDoubleOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Double]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getBooleanOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Boolean]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getConfigOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Config]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getListOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[List[ConfigValue]]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getDurationOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[FiniteDuration]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;getBytesOpt(path)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Option[Long]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre&gt;&lt;code class=&quot;language-scala&quot;&gt;config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;hasPath&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;b.c&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;hl-comment&quot;&gt;// true&lt;/span&gt;
config&lt;span class=&quot;hl-punctuation&quot;&gt;.&lt;/span&gt;getStringOpt&lt;span class=&quot;hl-punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;&amp;quot;nope&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-punctuation&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;hl-comment&quot;&gt;// None&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;merging&quot;&gt;Merging&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Returns&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;withFallback(other: Config)&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;Config&lt;/code&gt;&lt;/td&gt;&lt;td&gt;This config wins; &lt;code&gt;other&lt;/code&gt; supplies defaults for keys this config lacks. Objects merge recursively; arrays and scalars replace.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;See the &lt;a href=&quot;/guide/merging/&quot;&gt;merging guide&lt;/a&gt; for the full semantics.&lt;/p&gt;
&lt;h2 id=&quot;the-value-tree&quot;&gt;The value tree&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;getValue&lt;/code&gt; and &lt;code&gt;getList&lt;/code&gt; hand back &lt;code&gt;ConfigValue&lt;/code&gt; nodes — the raw, untyped tree:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ConfigObject(fields: Map[String, ConfigValue])&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ConfigArray(elements: List[ConfigValue])&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ConfigString(value: String)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ConfigNumber(raw: String)&lt;/code&gt; — the original literal text, parsed on demand&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ConfigBoolean(value: Boolean)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ConfigNull&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;Config.root&lt;/code&gt; exposes the top-level &lt;code&gt;ConfigObject&lt;/code&gt; directly.&lt;/p&gt;
&lt;h2 id=&quot;exceptions&quot;&gt;Exceptions&lt;/h2&gt;
&lt;p&gt;All errors extend &lt;code&gt;HoconException&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ParseError(message, line, col)&lt;/code&gt; — a syntax error, with 1-based source position.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MissingPathException(path)&lt;/code&gt; — nothing at the requested path (or it is &lt;code&gt;null&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WrongTypeException(path, expected, found)&lt;/code&gt; — the value is the wrong type for the getter.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UnresolvedSubstitutionException(path)&lt;/code&gt; — a required &lt;code&gt;${path}&lt;/code&gt; found in neither the config
nor the environment.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CircularReferenceException(chain)&lt;/code&gt; — substitutions reference each other in a cycle.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HoconConcatException(message)&lt;/code&gt; — a value concatenation mixes incompatible kinds, such as an
object or array joined with a string.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>
</feed>
