Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export neo4j database in json file

I want to export Neo4j graph database in JSON file.

This is a Export JSON button in Neo4j web UI version as shown in attached image below. enter image description here

But what is the equivalent command for the same task in Neo4j shell.

Thanks

like image 641
Gagan Avatar asked Jul 07 '14 10:07

Gagan


People also ask

Does Neo4j support JSON?

Importing JSON Data into Neo4jThere are a plethora of JSON-based Web APIs that we can import into Neo4j, and we can use one of the Load JSON procedures to retrieve data from these APIs and turn it into map values ready for Cypher to consume.

How do I export a JSON file?

To export package JSON first open a package, find the Import/Export dropdown and press the Export button. After that, the browser will start a download. The exported JSON file is formatted so it will be easy to track the difference between such files.

How do I export a Neo4j database to CSV?

You can already export CSV from the Neo4j Browser by clicking the download icon on the table view of your Cypher query results. Alternatively, you can also use my neo4j-shell-tools to export results of a Cypher query to a CSV file.


1 Answers

The json exported by the browser is exactly what is getting sent to the transactional cypher endpoint. This is not directly accessible via neo4j-shell, but you might use any command line http client like cURL or httpie.

For httpie it's as simple as:

 http -b -j localhost:7474/db/data/transaction/commit statements:='[{"statement": "<your cypher goes here>", "parameters": { cypher parameters go here as map }]'

However it is simple to extend neo4j-shell, see Michael's neo4j-shell-tools.

like image 171
Stefan Armbruster Avatar answered Sep 25 '22 12:09

Stefan Armbruster