Search code examples
csvneo4jquotations

Neo4j import quotation error


I'm using neo4j-import to load a large csv file into neo4j database. However, I got an error message saying

"there's a field starting with a quote and whereas it ends that quote there seems to be characters in .... {"id": 1241118", "text": "One person said, ""Harted it. ONE person said, \""'

it shows that there are illegal quotations in the csv file that neo4j cannot process, but I can't figure out how to get rid of it. I think there are two possible solutions. 1) pre-process csv file to get rid of illegal quotation marks. 2) neo4j-import has an argument option --quote, maybe we can do something with this, but I've tried several quotations, none of them work.

I appreciate that if you can shed light on this issue. Since my csv file is very large, is there any convenient way to solve this problem? Thanks.


Solution

  • It looks to me like you'd really want three layers of quotations here. The whole string is a JSON string which you make an attempt to have intact, which means you're double-quoting the quotes in it. Then you're trying to quote some text inside the already double-quoted string. This isn't supported.

    If you'd have another character, say ' as quotation instead I think you could have such a string simply look like:

    {"id": 1142347, "text": "That sounds \"muy fantastica,\" Debbie. Thanks for sharing!\n\n-- MichaelR, Community Manager, Aetna", }

    because you're probably not really interested in interpreting quoting inside this JSON string