Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import json data in neo4j

Tags:

json

neo4j

I have json data and i want to import in neo4j.

Export data option will be there in neo4j but how to import JSON data in neo4j.

This is the link of jsfiddle. http://jsfiddle.net/harmeetsingh090/mkdm4t44/

Please help if someone know.

like image 465
Harmeet Singh Avatar asked Nov 19 '14 06:11

Harmeet Singh


2 Answers

You can use jq to manipulate your data into CSV format and then use the LOAD CSV command.

like image 144
Mark Needham Avatar answered Oct 28 '22 00:10

Mark Needham


Neo4J doesn't have a native way of doing this, but there is a plugin for Neo4J called apoc.load.json. You can load data doing the following:

CALL apoc.load.json("file:///<path_to_file>/example.json") YIELD value as document
UNWIND document.root AS root
MERGE (e:ExampleNode {id: root.id})
...

You can find more information on the plug here: https://neo4j-contrib.github.io/neo4j-apoc-procedures/. I've recently used this and found it to be quite intuitive.

like image 32
Amit Sinha Avatar answered Oct 28 '22 01:10

Amit Sinha