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

HOCON is an super set of JSOn with 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 Hocon, Object attributes are be separated by new line

role: {
 id: 24
 name: 'admin'
 active: false
}
Hocon   json  
It is used as a configuration language for environment specific It is data transfer format used in between different systems
It is a super set of JSON and All the syntax of JSON works JSON syntax
Comments are supported Comments are not supported
Includes and substitution 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 inheritence principles Not supported