Trim whitespace
Create JSON output directories, if they don't exist

Closes #40.