use to_json for string values, fixes javascript errors for strings ending in \