Feature/pass all json config

This is @nichtich's work from #520 rebased, cleaned up and squished (to help make reviewing it easier).

Plus tests! Closes #512 (and #520).