# Export neo4j data to json file

**URL:** <https://community.neo4j.com/t/export-neo4j-data-to-json-file/29283>\
**Category:** Cypher\
**Tags:** apoc, cypher, export, json, neo4j-desktop\
**Created:** [November 19, 2020, 10:52am UTC](https://community.neo4j.com/t/export-neo4j-data-to-json-file/29283 "2020-11-19T10:52:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beginner](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@beginner](https://community.neo4j.com/u/beginner)\
**Post date:** [November 19, 2020, 10:52am UTC](https://community.neo4j.com/t/export-neo4j-data-to-json-file/29283/1 "2020-11-19T10:52:25Z")

</div>

I have neo4j database with 20 nodes, but there is only 2 label,x and y, now if I export data like below

```auto
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**

```auto
	with open('./data/hello.json') as df:
		df1= json.load(df)
		print(df1)

```

**Actual Output**

```auto
[{'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**

```auto
{'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

```

---

<div class="post-metadata">

**Author:** ![tarendran.vivekanand](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tarendran.vivekanand/32/3909_2.png) [@tarendran.vivekanand](https://community.neo4j.com/u/tarendran.vivekanand)\
**Post date:** [November 24, 2020, 9:48am UTC](https://community.neo4j.com/t/export-neo4j-data-to-json-file/29283/2 "2020-11-24T09:48:17Z")

</div>

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

```auto
apoc.import.file.enabled=true
apoc.export.file.enabled=true

```

Export the database

```auto
CALL apoc.export.graphml.all("test.graphml", {})

```

Import the database

```auto
CALL apoc.import.graphml("test.graphml",{readLabels:true})

```

You can read up more [here](https://neo4j.com/labs/apoc/4.1/export/graphml/#export-graphml-whole-database)
