cancel
Showing results for 
Search instead for 
Did you mean: 

String text in JSON output incorrectly using csv parser/formatter to csv

vincenr
New Contributor III

I’ve got the following text in a description field in my raw JSON file, where the double quotes are obviously escaped. How can I change settings in the JSON formatter and/or the CSV parser/formatter to fix this problem? The snaps are at their default settings.

JSON:
“Charts the development of Black Art in the United States and Great Britain from 1945 to the present through Paul Gilroy’s notion of the \“Black Atlantic\” – the ways that a distinct aesthetic emerged from a fusion of West African, American, and British traditions. Also listed as ART 294.”,

But when output to csv, it looks like this:

colA: Charts the development of Black Art in the United States and Great Britain from 1945 to the present through Paul Gilroy’s notion of the \Black Atlantic\" – the ways that a distinct aesthetic emerged from a fusion of West African

colB: American

colC: and British traditions. Also listed as ART 294."

So, it appears that the commas in the text are causing it to split into multiple columns and the escaped double quotes don’t end up as just double quotes. In other words, the default setting of '' in the CSV formatter doesn’t appear to be working to resolve text fields like the one above.

I found this on a site, which states that if a backslash is immediately followed by a double quote (\") that the csvformat function won’t work: [CSV-200] CSVFormat cannot read its own output if input contain escape character followed by quote c.... Not sure if this is the same function that your csv formatter snap is using?

UPDATE

The recommendation on the site above was to remove either the " or the \ and I removed the \ and it fixed my text problem!

6 REPLIES 6

vincenr
New Contributor III

How would the syntax work for CRLF? That is, if I only want to replace
CRLF with a space in a field?

vincenr
New Contributor III

Never mind, I figured it out.