Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-19-2020 02:52 AM
I have neo4j database with 20 nodes, but there is only 2 label,x and y, now if I export data like below
MATCH (n) RETURN n
after the result of the above command, just used the option Export JSON and saved the JSON file
everynode comes as single element in the list between square brackets in JSON file, but I want it all 20 nodes as separate in the same JSON file. when I load it and print the results, it prints in the single line as
code
with open('./data/hello.json') as df:
df1= json.load(df)
print(df1)
Actual Output
[{'n': {'identity': 50, 'labels': ['x'], 'properties': {'name': 'a', 'place': 'b', 'id': 001}}}, {'n': {'identity': 51, 'labels': ['x'], 'properties': {'name': 'c', 'place': 'd', 'id': 002}}},....]
Expected Output
{'n': {'identity': 50, 'labels': ['x'], 'properties': {'name': 'a', 'place': 'b', 'id': 001}}},
{'n': {'identity': 51, 'labels': ['x'], 'properties': {'name': 'c', 'place': 'd', 'id': 002}}},
.
.
.
so on
11-24-2020 01:48 AM
Hi @beginner,
If you want to transfer your neo4j database, then you can use these commands
Make you sure you enable export file and import file in your configurations
apoc.import.file.enabled=true
apoc.export.file.enabled=true
Export the database
CALL apoc.export.graphml.all("test.graphml", {})
Import the database
CALL apoc.import.graphml("test.graphml",{readLabels:true})
You can read up more here
All the sessions of the conference are now available online