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
}
Hoconjson
It is used as a configuration language for environment specificIt is a data transfer format used in between different systems
It is a superset of JSON and All the syntax of JSON worksJSON syntax
Comments are supportedComments are not supported
Includes and substitutions are supportedNo support for includes and substitutes
Can write config without double quotesIt is very difficult without double quotes for key and values
Support DRY and inheritance principlesNot supported