hocon is abbreviated as Human-Optimized Configuration Object Notation

It is a new format that is a superset of JSON file type which means json file works as a hocon conf file type Hocon syntax is equal to strict JSON syntax.

It is used to store configuration files like toml or ini .

This course series posts help you to get the basics of hocon with examples for learning.

Important points

  • It is case sensitive
  • file extension is .conf
  • Tabs are not allowed,
  • Some editors allow spaces

For example, The below three values are equal in the Hocon Configuration file

 { "key"=value } or
 "key"=value,  or
  key=value  or

Advantages of hocon

  • Lightweight
  • It is very easy and simple to represent the complex mapping
  • Friendly readable and writable
  • Simple to modify with any text editor
  • Suitable for configuration settings
  • Merging
  • substitution
  • Complex configuration can be declared.

Disadvantages of Hocon

  • It is a new format introduced recently, and a learning curve exists.
  • Not much popular other than XML and json

hocon file extension

hocon files created with the extension .conf or .hocon You can use any IDE or text editor to open and create this file.

All the popular IDE supports the hocon file extension and also provide plugins to validate the hocon file content.

MIME format type - application/hocon

There is no office MIME type for hocon document content as per IANA , but it can be represented using application/hocon

When hocon data is transferred between client and server, Implementation vendors add MIME type settings specified in request and response across the internet. Content-Type and accept headers in a request object are specified with this format following is the mime type for this document

application/hocon

and request contains the below value for hocon data sending over the internet

Content-type : application/hocon:

Features

  • Strict JSON syntax
  • Comments
  • Variable substitution
  • Map and array values
  • Includes other hocon configuration files

Hocon Syntax Reference

  • parenthesis ({}) to Root element is ignored
  • You can use key and value with a separator (: or =)
  • Double quotes to keys and values are not required and optional
  • Objects or array attributes are separated by a new line
  • Comments always start with # or \