Gagan
Gagan

Reputation: 4378

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

Upvotes: 7

Views: 5893

Answers (2)

Decebal
Decebal

Reputation: 1419

Both using the api and the shell tools are good solutions. But they don't seem scalable, in a containerized environment it will be kind of difficult to automate this process.

The Geoff package is really great and there are tools as this in other languages too, if needed. The speed it reads and dumps the data made me more confident in this solution as opposed to the others.

Later Edit: I noticed you are looking for the specific Json Format, I found another cool library that can help with that pretty quick if you need.

Upvotes: 0

Stefan Armbruster
Stefan Armbruster

Reputation: 39915

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.

Upvotes: 7

Related Questions