{"action":"opened","issue":{"url":"https://api.github.com/repos/zemirco/json2csv/issues/85","labels_url":"https://api.github.com/repos/zemirco/json2csv/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/zemirco/json2csv/issues/85/comments","events_url":"https://api.github.com/repos/zemirco/json2csv/issues/85/events","html_url":"https://github.com/zemirco/json2csv/issues/85","id":114301683,"number":85,"title":"Backslashes not handled properly","user":{"login":"ahaurw01","id":2068437,"avatar_url":"https://avatars.githubusercontent.com/u/2068437?v=3","gravatar_id":"","url":"https://api.github.com/users/ahaurw01","html_url":"https://github.com/ahaurw01","followers_url":"https://api.github.com/users/ahaurw01/followers","following_url":"https://api.github.com/users/ahaurw01/following{/other_user}","gists_url":"https://api.github.com/users/ahaurw01/gists{/gist_id}","starred_url":"https://api.github.com/users/ahaurw01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahaurw01/subscriptions","organizations_url":"https://api.github.com/users/ahaurw01/orgs","repos_url":"https://api.github.com/users/ahaurw01/repos","events_url":"https://api.github.com/users/ahaurw01/events{/privacy}","received_events_url":"https://api.github.com/users/ahaurw01/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-30T16:15:11Z","updated_at":"2015-10-30T16:15:11Z","closed_at":null,"body":"There are two bugs related to the handling of backslashes:\r\n\r\n1. When given strings with backslashes in them, `json2csv` produces 4x the number of backslashes as is appropriate. Some background and examples:\r\n\r\n   ```\r\n   $ node\r\n   > s = 'hello\\\\world'\r\n   'hello\\\\world'\r\n   > console.log(s)\r\n   hello\\world\r\n   > JSON.stringify(s)\r\n   '\"hello\\\\\\\\world\"'\r\n   > console.log(JSON.stringify(s))\r\n   \"hello\\\\world\"\r\n   \r\n   $ json2csv\r\n     [{\"msg\":\"hello\\\\\\\\world\"}]\r\n     \"msg\"\r\n     \"hello\\\\\\\\world\"\r\n   ```\r\n1. When a string ends with a backslash, the resulting csv cannot be parsed.\r\n\r\n   ```\r\n   $ json2csv\r\n     [{\"msg\":\"hello\\\\\\\\\"}]\r\n     \"msg\"\r\n     \"hello\\\\\\\"\"\r\n   ```\r\n\r\n\r\nThe expected results would be:\r\n\r\n```\r\n\"msg\"\r\n\"hello\\world\"\r\n```\r\n\r\nand\r\n\r\n```\r\n\"msg\"\r\n\"hello\\\"\r\n```"}}