json: escape strings

This is the same change I added originally in #23, but now with its own branch on my side, and thus a new PR. It seems to be the "good" way to do this on GitHub, right? :)