Closed thinkjson closed 12 years ago
Affected lines, as far as I can tell: https://github.com/jehiah/json2csv/blob/master/json2csv.c#L78-80
It looks like you're fetching the unescaped string, and then printing that straight to the CSV file. You could probably get away with using the JSON escape function (https://github.com/jehiah/json-c/blob/master/json_object.c#L74) as the rules are similar enough.
I found a work-around that also fixes numbers and nulls. I've sent a pull request.
If I have the source JSON
then when I run
json2csv -k message <JSON
, the output looks likewhich breaks any CSV reader. The escaping used in the JSON should be carried over to the CSV.