cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Why Cypher doesn't support quote in property keys?

ri8ika
Graph Voyager

Why the Cypher doesn't support quotes in property key? For eg.

The following will throw an error:

CREATE (l:Label 
   {
      'name': "Some Int'l name"
   }
)
RETURN l

Invalid input ''': expected whitespace, comment, a property key name, '}', an identifier or UnsignedDecimalInteger

But following works:

CREATE (l:Label 
   {
      name: "Some Int'l name"
   }
)
RETURN l

I am concerned because I need to query with Cypher from some json request. How can we do that? Converting the quotes from dict keys only seems to be very much difficult process:

r = { 'name': "Some Int'l name" }
other_example = { 'foo': 'this contains foo', 'bar': 'this contains bar' }

How would you replace { 'name': "Some Int'l name" } with {name: "Some Int'l name" } from a docstring? The docstring even may contain double quote: {"name": "Some Int'l name"}.

1 ACCEPTED SOLUTION

ri8ika
Graph Voyager

Okay, I have managed to use entry manually rather than json object.

View solution in original post

2 REPLIES 2

ameyasoft
Graph Maven

surround it with backticks (on the kwyboard the tilde key) instead of double quotes.

ri8ika
Graph Voyager

Okay, I have managed to use entry manually rather than json object.