Simplify getting an optional key from a dict with a default value.
Added support for JSON input files.
Converted cascading if-then-else into a map of extension -> ctor.