I am using py2neo to load JSON data into Neo4j as chyper statements.
My problem is that sometimes there are signs as “ ‘ \\
etc in the strings I want to impor
I would suggest to use parameters, then the cypher parser doesn't see them.
And it's just an name -> string you pass via a dictionary to the execute method.
If you want to include double quotes, you can wrap in single quotes:
CREATE (n:Node {name:'hello " world'})
RETURN n.name
n.name
hello " world
If you want to include single quotes, you can wrap in double quotes:
CREATE (n:Node {name:"hello ' world"})
RETURN n.name
n.name
hello ' world
If it's more complicated than that, you can escape the character:
CREATE (n:Node {name:"hello \" world"})
RETURN n.name
n.name
hello " world
You can also include backslashes by escaping them:
CREATE (n:Node {name:"hello \\ world"})
RETURN n.name
n.name
hello \ world