JSON generator: Don't segfault when passing null as String.

Closes #762
Merge pull request #763 from fredreichbier/null-as-string

JSON generator: Don't segfault when passing null as String.