# Read nested json

**URL:** <https://community.neo4j.com/t/read-nested-json/13171>\
**Category:** Cypher\
**Tags:** cypher\
**Created:** [December 27, 2019, 12:40pm UTC](https://community.neo4j.com/t/read-nested-json/13171 "2019-12-27T12:40:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aartipawar2101](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/aartipawar2101/32/5260_2.png) [@aartipawar2101](https://community.neo4j.com/u/aartipawar2101)\
**Post date:** [December 27, 2019, 12:40pm UTC](https://community.neo4j.com/t/read-nested-json/13171/1 "2019-12-27T12:40:32Z")

</div>

\*\*I AM new to neo4j. Can anyone help me creating cypher query for below json.  
I've a path array in my code which contains three objects, i want to get 3 separate nodes as path1, path2, path3 containing x, y, z properties in each path respectively.  
thanks in advance.  
\*\*

```auto
{
"nets": [{
			"name": "Net 0",
			"path": [{
						"x": 0.949999988079071,
						"y": 0.009999999776482582,
						"z": 0.20000000298023224
					}, {
						"x": 0.949999988079071,
						"y": 0.009999999776482582,
						"z": 0.6000000238418579
					}, {
						"x": -0.8499999642372131,
						"y": 0.009999999776482582,
						"z": 0.6000000238418579
					}
				],
			"pins": [[0, 2], [1, 1]]
		}, {
			"name": "Net 1",
			"path": [{
						"x": 5.25,
						"y": 0.009999999776482582,
						"z": 0
					}, {
						"x": 5.25,
						"y": 0.009999999776482582,
						"z": 0.20000000298023224
					}, {
						"x": 2.049999952316284,
						"y": 0.009999999776482582,
						"z": 0.20000000298023224
					}
				],
			"pins": [[-1, 1], [0, 1]]
		}, {
			"name": "Net 2",
			"path": [{
						"x": -1.9500000476837158,
						"y": 0.009999999776482582,
						"z": 0.6000000238418579
					}, {
						"x": -1.9500000476837158,
						"y": 0.009999999776482582,
						"z": 0
					}, {
						"x": -5.150000095367432,
						"y": 0.009999999776482582,
						"z": 0
					}
				],
			"pins": [[1, 2], [-1, 2]]
		}
	]
}

```

---

<div class="post-metadata">

**Author:** ![paulare](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paulare/32/8304_2.png) [@paulare](https://community.neo4j.com/u/paulare)\
**Post date:** [December 27, 2019, 5:01pm UTC](https://community.neo4j.com/t/read-nested-json/13171/2 "2019-12-27T17:01:10Z")

</div>

Hi, there is an issue you should consider in your model. Currently, It is `not` possible to add nested property as a property (path values). So you may have to create separate nodes.

```auto
UNWIND ['13171.json'] as filename
CALL apoc.load.json(filename) YIELD value AS v
WITH v.nets as nets
UNWIND nets as net
WITH net
MERGE (Net:NetNode {name: net.name})
	FOREACH (xyz in net.path | MERGE (Net)-[:has_xyz]->(:XYZ {x: xyz.x, y: xyz.y, z:xyz.z}))

```

If you unpack your XYZ values into separate nodes you can get something like that.

 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/b/b9c79714f18547db196fbcd0f35656405b31f999.png)

---

<div class="post-metadata">

**Author:** ![aartipawar2101](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/aartipawar2101/32/5260_2.png) [@aartipawar2101](https://community.neo4j.com/u/aartipawar2101)\
**Post date:** [December 30, 2019, 11:51am UTC](https://community.neo4j.com/t/read-nested-json/13171/3 "2019-12-30T11:51:57Z")

</div>

Thank for great help!!!!

---

<div class="post-metadata">

**Author:** ![William\_Lin](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/william_lin/32/7761_2.png) [@William\_Lin](https://community.neo4j.com/u/William_Lin)\
**Post date:** [March 22, 2020, 9:04am UTC](https://community.neo4j.com/t/read-nested-json/13171/4 "2020-03-22T09:04:28Z")

</div>

Hi, everyone.  
Could I echo this question?  
If I already create those nodes in neo4j database, does Neo4j have any possibility to run a MATCH  
with nested JSON property?  
Just using Neo4j ETL tool to transfer those data from MYSQL to Neo4j, and I still try to think how to separate those nodes.

 ![螢幕快照 2020-03-22 下午5.01.25](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/5/50ec51ba4eb3882d96de7fd6769a380c196cfc5f.png)
