Hjson Syntax

TL;DR here




JSON-stringany character except ,:[]{} and whitespace:value








"'any character except starting quote and \\'single quote"quotation mark\reverse solidus/solidusbbackspacefformfeednnewlinercarriage returnthorizontal tabu4 hexadecimal digits"'


any character except ,:[]{}any character except LF


'''any character except three ' in a row'''


-0digit 1-9digit.digiteE+-digit


#any character except LF//any character except LF/*anything but * followed by /*/

Character means any UNICODE character except the control characters.



You can separate your values/members either with a comma or a new line.

Unlike JSON, trailing commas are ignored and do not produce a syntax error.

For example:

  one: 1
  two: 2,
  more: [3,4,5]
  trailing: 6,

You should omit optional commas to make your data more readable.

  one: 1
  two: 2

Whitespace & Comments

Whitespace and comments can be inserted between any pair of tokens.

Whitespace is defined as in the JSON specification (space, linefeed, carriage return, or horizontal tab).

Hash # or C style // comments start a single line comment.

The style is just a matter of preference. # may be easier on the eyes but // is sometimes used in existing JSON configs.

/* starts a multiline comment that ends with */. You can use it to comment out part of the data.


You only need to add quotes if the key name includes whitespace or any of the punctuators ({}[],:).

For example:

Quoteless Strings

A quoteless string cannot start with any of the punctuators ({}[],:).

Unlike a quoted string it automatically ends at the end of the current line. Do not add commas or comments as they would become part of the string. If you wish to add comments place them on the previous or next line.

Preceding and trailing whitespace is ignored. Escapes are only supported in quoted strings.

The Hjson parser will still detect values (number, true, false or null) and parse them correctly. For example

Multiline Strings

A multiline string is OS and file independent. The line feed is always \n.

For example

  My half empty glass,
  I will fill your empty half.
  Now you are half full.

Is the string "My half empty glass,\nI will fill your empty half.\nNow you are half full."


Quoted strings can be written with 'single' or "double" quotes.

Note: single quotes are new (2017/7) and may not yet be supported on all platforms.

Root Braces

Hjson allows you to omit {} for the root object so that a config file can contain nothing but keys and values, similar to YAML.

Note: This feature was previously marked as deprecated but is now officially supported again. If you need maximum portability with your Hjson files, then we recommend you keep the root braces in case a third party implementation doesn't support it.

File extension



.hjson files must be encoded in UTF-8 (without a BOM).

Hjson does not have a header but if you want to indicate the file type you can use #hjson on the first line.


View the RFC draft (pending updates/root braces/single quotes)

Users Developers Syntax Try FAQ Feedback History