Implements writeJSON()
Merge pull request #9 from blai/master

Implements 'writeJSON'