fix JSON stringify to escape special characters

When converting from non string types the converted string was not escaped
Merge pull request #533 from rafzi/develop

fix JSON stringify to escape special characters