Add empty data dir if needed when writing json. Fixes #2