Remove check for file before write

Fixes #274.
Change function call to "to_json"
Merge pull request #370 from adamrp/issue-274

Remove check for file before write