Package org.apache.juneau.marshall.hocon


package org.apache.juneau.marshall.hocon
HOCON (Human-Optimized Config Object Notation) format serializer and parser for Apache Juneau.

HOCON is a superset of JSON used extensively in the JVM ecosystem (Akka, Play, sbt, Spark, Kafka) for configuration. It extends JSON with:

  • Path expressions — a.b.c = value creates nested objects
  • Equals sign separator — key = value (HOCON convention)
  • Unquoted strings — keys and values without quotes when unambiguous
  • Object merging — duplicate keys merge instead of overwrite
  • Substitutions — ${var} and ${?var} references (parse only)
  • Triple-quoted strings — """...""" with no escape processing
  • Comments — # and //
  • Optional root braces — top-level without {}
Bean mapping

Round-trip fidelity matches JSON: beans, maps, lists, primitives, dates (ISO 8601), and Duration all round-trip. Substitutions and value concatenation are resolved during parse; the serializer always writes concrete values.

Usage:

String hocon = HoconSerializer.DEFAULT.write(myBean); MyBean bean = HoconParser.DEFAULT.read(hocon, MyBean.class); // Or use the marshaller: String hocon = Hocon.of(myBean); MyBean bean = Hocon.to(hocon, MyBean.class);

See Also: