JSON is a data format for transferring data between different machines hocon is configurable data for environment settings like dev, test, stage, and production environment.

HOCON is a superset of JSOn with the below features

  • includes
  • substitutions
  • comments

Let’s see the difference between the two file formats.

JSON declared as follows

"roles": {
    "type": "admin"
}

The same can be rewritten in hocon double quotes are not required and optional in hocon

roles: {
    type: admin
}

colon(:) before { are not optional

roles {
    type: admin
}

In json, Object properties are separated by ,

JSON object example

role: {
 id: 24,
 name: 'admin',
 active: false,
}

In Houston, Object attributes are separated by a new line

role: {
 id: 24
 name: 'admin'
 active: false
}
Hocon json
It is used as a configuration language for environment specific It is a data transfer format used in between different systems
It is a superset of JSON and All the syntax of JSON works JSON syntax
Comments are supported Comments are not supported
Includes and substitutions are supported No support for includes and substitutes
Can write config without double quotes It is very difficult without double-quotes for key and values
Support DRY and inheritance principles Not supported