Skip to content
Easy to use configuration and parser.
Crystal Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Docs GitHub release Build Status is a parser for a configuration format designed to be more effective then JSON, YAML, INI, and HJSON. It alos inherits aspects from 'OpenBSD style' configs like macros.

$self =

json:    Too many quotes
yaml:    Pays attention to whitespace
ini:     No nesting
hjson:   Data oriented. Support?
openbsd: Macros are awesome

/* If only something combined the good
   parts and got rid of the bad */

answer: $self


Add this to your application's shard.yml:

    github: chris-huxtable/


require "config"

You can parse a file with:

config = Config.file("/path/to/file.conf")

You can access the entries via the Config::Any objects.

config = Config.parse("username: chris, link:")

username = config.as_s("username")
link = config.as_a("link")


Root Object:

The root is considered an object. That is to say you must provide a key for any root entry and you should not wrap entries in {}.

key: "value"


Unlike JSON, object keys can be specified without quotes.

rate: 1000


Unlike JSON, strings can be specified without quotes so long as it doesn't contain special characters like :, =, {, }, [, ], or ,. Though, :, = are allowed if they are not a key.

rate: This is a string.


Unlike JSON, entries can be separated with commas, or newlines.

first: 1
second: 2, third: 3


There are three types of comments to support the common commenting styles.

Hash Comments:

A to-end-of-line comment initiated by a # symbol. As common in Crystal, Ruby, Python, Shell, Perl, et al.

# hash style comments
# (because it's just one character)

Line Comments:

A to-end-of-line comment initiated by a //. As common in C, Objective-C, C++, D, Swift, PHP, JavaScript, et al.

// line style comments
// (because it's like C/Objective-C/...)

Block Comments:

A block comment initiated by a /* and terminated by */. As common in C, Objective-C, C++, D, Swift, PHP, et al.

/* block style comments because
   it allows you to comment out a block */

Note: This does not yet support nested comments.


A macro is a saved value which can be referenced in the rest fo the document. The key must be prefixed with a $ and assigned with a = as opposed to a :.

$defaultName = "Default Name"
$nameKey = name

$defaultObject = {
	first: 1
	second: 2

$nameKey: $defaultName
object: $defaultObject

Note: Macro's cannot yet be inserted into strings.

Fault Tolerance:

Recovers from easy to make mistakes. Like useless comma's.

first: 1
second: 2,
third: 3,,,


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


You can’t perform that action at this time.