Update JSONWriter.php

Attempt to cast WriteValue values as string, throw exception otherwise.