如何解析json并在Neo4j中使用foreach创建节点?

问题描述 投票:0回答:1

示例json:

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

我正在尝试创建3个具有文件和类型作为属性的节点

我正在使用以下查询在neo4j中创建节点

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

使用py2neo驱动程序时出现以下错误:

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

neo4j cypher py2neo gql neo4j-apoc
1个回答
0
投票

查询应类似于-

 WITH {json} AS document
 FOREACH (node in document.data| CREATE(m:`memeber`) SET m = node )
© www.soinside.com 2019 - 2024. All rights reserved.