0

Sample json:

{
    "data": [
            {
                "file" : "1.txt",
                "type" : "text"
            },
            {
                "file" : "2.json",
                "type" : "json"
            },
            {
                "file" : "1.html",
                "type" : "html"
            }
    ]
}

I am trying to create 3 nodes with file and type as properties

I am using following query to create nodes in neo4j

WITH {json} AS document 
UNWIND document.data AS data
FOREACH (node in data| CREATE(m:`member`) SET m = node )

I am getting following error when i use py2neo driver:

AttributeError: 'module' object has no attribute 'SyntaxError'

2 Answers 2

1

In your case either use UNWIND or FOREACH

WITH {json} AS document 
UNWIND document.data AS data
CREATE(m:`member`) SET m = data

or

WITH {json} AS document 
FOREACH (node in document.data | CREATE(m:`member`) SET m = node )
Sign up to request clarification or add additional context in comments.

Comments

0

Query should be like -

 WITH {json} AS document
 FOREACH (node in document.data| CREATE(m:`memeber`) SET m = node )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.