fix JSON stringify to escape special characters

When converting from non string types the converted string was not escaped