PropDicts.jl

PropDicts implements dictionaries that handle hierarchical property/value data.

PropDict is a special kind of AbstractDict that supports deep merging. A typical use case is cascading-configuration: A basic configuration can be modified by additional configuration PropDicts that only replace, amend or remove specific parts of it.

PropDicts can be constructed from dicts, key-value pairs and keyword arguments, as well as from named-tuple syntax via @propdict:

using PropDicts

p1 = PropDict(:a => PropDict(:b => 7, :c => 5), :e => "foo")
p2 = PropDict(a = PropDict(b = 7, c = 5), e = "foo")
p3 = @propdict (a = (b = 7, c = 5), e = "foo")
p1 == p2 == p3

In addition, there is support for variable substitution, to make it possible to refer to environment variables and application-specific variables in configuration data.

Reading/writing from/to JSON and YAML is supported as well.

PropertyDicts.jl provides a light-weight property-access wrapper around arbitrary dictionaries. In contrast, PropDict is a concrete dict type geared towards hierarchical configuration data, adding deep merging, null handling, variable substitution, auto-creation of nested entries and file I/O.