Escape control chars in JSON.stringify