Class HoconParser

All Implemented Interfaces:
HoconMetaProvider, RecordReadable

public class HoconParser extends ReaderParser implements HoconMetaProvider, RecordReadable
Parses HOCON (Human-Optimized Config Object Notation) text into POJO models.
Media types

Handles Content-Type types: application/hocon

Description

Multi-pass parsing strategy: tokenize → build intermediate tree → resolve substitutions → convert to bean.

Accepts all three key-value separators: = (HOCON convention), : (JSON style), and whitespace before { (for object values).

Supports unquoted string keys and values, path expressions (a.b.c = value), object merging, substitution resolution, triple-quoted strings, both // and # comments, and optional root braces.

Example input (bean):

name = myapp port = 8080 debug = true database { host = localhost port = 5432 } tags = [web, api, rest]

Limitations:
  • include directives are not supported — they are ignored with a warning during parsing.
  • Duration/size unit suffixes (10s, 5m, 512K, 2G) are treated as unquoted strings.
  • Substitutions are resolved before bean conversion; the resolved (concrete) values are what Juneau sees.
See Also: