# Problem importing JSON

**URL:** <https://community.neo4j.com/t/problem-importing-json/13019>\
**Category:** Procedures & APOC\
**Created:** [December 19, 2019, 5:22pm UTC](https://community.neo4j.com/t/problem-importing-json/13019 "2019-12-19T17:22:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwcqcon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jwcqcon/32/2505_2.png) [@jwcqcon](https://community.neo4j.com/u/jwcqcon)\
**Post date:** [December 19, 2019, 5:22pm UTC](https://community.neo4j.com/t/problem-importing-json/13019/1 "2019-12-19T17:22:39Z")

</div>

I am having a really difficult time importing from a JSON similar to this one. I have no problems with the majority of the data. It is the data contained in the section below that is:

"configurations" : {  
"ABC\_data\_version" : "4.0",  
"nodes" : [ {  
"operator" : "OR",  
"123\_match" : [ {  
"vulnerable" : true,  
"testdata" : "c:a:gksu-polkit\_project:gksu-polkit:_:_:_:_:_:_:_:_",  
"versionEndExcluding" : "0.0.3"  
} ]  
}, {  
"operator" : "OR",  
"123\_match" : [ {  
"vulnerable" : true,  
"testdata" : "abc:2.3:o:debian:debian\_linux:6.0:_:_:_:_:_:_:\*"  
} ]  
Here is a snippet of the cypher I am trying  
\<UNWIND ['test.json'] as filename\>  
\<CALL apoc.load.json(filename) YIELD value AS n\>

\<FOREACH (123\_match IN v.configurations.nodes.123\_match |\>  
\< FOREACH (abc23 IN v.configurations.nodes.123\_match[0].abc23Uri |\>  
\<MERGE (abc23Uri: abc23Uri {abc23Uri:abc\_match[0].abc23Uri})\>

The error message"Type mismatch: expected a map but was List{Map" is returned. I have tried using [0] and other fixes I have seen but none work. The 123\_match is the field I am unable to create a node with. Everything else works (non of the cypher for that is included here)

Source data example:  
"ABC\_Items" : [ {  
"ABC" : {  
"data\_type" : "ABC",  
"data\_format" : "ABCDE",  
"data\_version" : "4.0",  
"ABC\_data\_meta" : {  
"ID" : "ABC-1234-0703",  
"ASSIGNER" : "[ABC@ABCDE.org](mailto:ABC@ABCDE.org)"  
},  
"problemtype" : {  
"problemtype\_data" : [ {  
"description" : [ {  
"lang" : "en",  
"value" : "XYZ-20"  
} ]  
} ]  
},  
"references" : {  
"reference\_data" : [ {  
"qwe" : "[sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703](http://sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703)",  
"name" : "[sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703](http://sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703)",  
"refsource" : "MISC",  
"tags" : ["Broken Link"]  
}, {  
"qwe" : "[sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703](http://sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703)",  
"name" : "[sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703](http://sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703)",  
"refsource" : "MISC",  
"tags" : ["Third Party Advisory"]  
} ]  
},  
"description" : {  
"description\_data" : [ {  
"lang" : "en",  
"value" : "In gksu-polkit before 0.0.3, the source file for xauth may contain arbitrary commands that may allow an attacker to overtake an administrator X11 session."  
} ]  
}  
},  
"configurations" : {  
"ABC\_data\_version" : "4.0",  
"nodes" : [ {  
"operator" : "OR",  
"123\_match" : [ {  
"vulnerable" : true,  
"testdata" : "c:a:gksu-polkit\_project:gksu-polkit:_:_:_:_:_:_:_:_",  
"versionEndExcluding" : "0.0.3"  
} ]  
}, {  
"operator" : "OR",  
"123\_match" : [ {  
"vulnerable" : true,  
"testdata" : "abc:2.3:o:debian:debian\_linux:6.0:_:_:_:_:_:_:\*"  
} ]  
} ]  
},  
"impact" : {  
"baseMetricV3" : {  
"yyyyy3" : {  
"version" : "3.1",  
"vectorString" : "yyyyy:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",  
"attackVector" : "NETWORK",  
"attackComplexity" : "LOW",  
"privilegesRequired" : "NONE",  
"userInteraction" : "NONE",  
"scope" : "UNCHANGED",  
"confidentialityImpact" : "HIGH",  
"integrityImpact" : "HIGH",  
"availabilityImpact" : "HIGH",  
"baseScore" : 9.8,  
"baseSeverity" : "CRITICAL"  
},  
"exploitabilityScore" : 3.9,  
"impactScore" : 5.9  
},  
"baseMetricV2" : {  
"yyyyy2" : {  
"vers" : "2.0",  
"vectorStr" : "A",  
"accessV" : "NEK",  
"accessCo" : "LOW",  
"authentication" : "NONE",  
"confidentialityImpact" : "PARTIAL",  
"integrityImpact" : "PARTIAL",  
"availabilityImpact" : "PARTIAL",  
"baseScore" : 7.5  
},  
"severity" : "HIGH",  
"exploitability" : 10.0,  
"impac" : 6.4,  
"acIn" : false,  
"obtainAllP" : false,  
"obtainUser" : false,  
"obtainOther" : false,  
"userInteraction" : false  
}  
},  
"publishedDate" : "2019-11-15T17:15Z",  
"lastModifiedDate" : "2019-12-03T14:55Z"  
},  
Please provide the following information if you ran into a more serious issue:

- neo4j version, desktop version, browser version  
3.5.6, Browser version 4.0.1
-

---

<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 20, 2019, 12:29pm UTC](https://community.neo4j.com/t/problem-importing-json/13019/2 "2019-12-20T12:29:02Z")

</div>

Your Cypher Query has abc23Uri key - but thats missing from your example JSON.  
If possible, please review test.json you provided.

I suggest to use bit post formatting - like preformatted text option - then its easier to read and copy-paste code/JSON snippets.

Like that:

```auto
{
	"ABC_Items": [{
		"ABC": {
			"data_type": "ABC",
			"data_format": "ABCDE",
			"data_version": "4.0",
			"ABC_data_meta": {
				"ID": "ABC-1234-0703",
				"ASSIGNER": "ABC@ABCDE.org"
			},
			"problemtype": {
				"problemtype_data": [{
					"description": [{
						"lang": "en",
						"value": "XYZ-20"
					}]
				}]
			},
			"references": {
				"reference_data": [{
					"qwe": "sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703",
					"name": "sdfkjsadhkjaccess.redhat.com/security/ABC/ABC-1234-0703",
					"refsource": "MISC",
					"tags": ["Broken Link"]
				}, {
					"qwe": "sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703",
					"name": "sdfkjsadhkjsecurity-tracker.debian.org/tracker/ABC-1234-0703",
					"refsource": "MISC",
					"tags": ["Third Party Advisory"]
				}]
			},
			"description": {
				"description_data": [{
					"lang": "en",
					"value": "In gksu-polkit before 0.0.3, the source file for xauth may contain arbitrary commands that may allow an attacker to overtake an administrator X11 session."
				}]
			}
		},
		"configurations": {
			"ABC_data_version": "4.0",
			"nodes": [{
				"operator": "OR",
				"match_123": [{
					"vulnerable": true,
					"testdata": "c:a:gksu-polkit_project:gksu-polkit::::::::",
					"versionEndExcluding": "0.0.3"}]}, {
				"operator": "OR",
				"match_123": [{
					"vulnerable": true,
					"testdata": "abc:2.3:o:debian:debian_linux:6.0:::::::*"
				}]
			}]
		},
		"impact": {
			"baseMetricV3": {
				"yyyyy3": {
					"version": "3.1",
					"vectorString": "yyyyy:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
					"attackVector": "NETWORK",
					"attackComplexity": "LOW",
					"privilegesRequired": "NONE",
					"userInteraction": "NONE",
					"scope": "UNCHANGED",
					"confidentialityImpact": "HIGH",
					"integrityImpact": "HIGH",
					"availabilityImpact": "HIGH",
					"baseScore": 9.8,
					"baseSeverity": "CRITICAL"
				},
				"exploitabilityScore": 3.9,
				"impactScore": 5.9
			},
			"baseMetricV2": {
				"yyyyy2": {
					"vers": "2.0",
					"vectorStr": "A",
					"accessV": "NEK",
					"accessCo": "LOW",
					"authentication": "NONE",
					"confidentialityImpact": "PARTIAL",
					"integrityImpact": "PARTIAL",
					"availabilityImpact": "PARTIAL",
					"baseScore": 7.5
				},
				"severity": "HIGH",
				"exploitability": 10.0,
				"impac": 6.4,
				"acIn": false,
				"obtainAllP": false,
				"obtainUser": false,
				"obtainOther": false,
				"userInteraction": false
			}
		},
		"publishedDate": "2019-11-15T17:15Z",
		"lastModifiedDate": "2019-12-03T14:55Z"
	}]
}

```

Before using FOREACH - i would experiment to with getting data just with a RETURN clause.  
I had to rename key 123\_match in JSON file to match\_123 - for some reason first one caused issues.

```auto
UNWIND ['Jcrowell.json'] as filename
CALL apoc.load.json(filename) YIELD value AS v
RETURN v.ABC_Items[0].configurations.nodes[0].match_123[0].testdata

```

```auto
│"v.ABC_Items[0].configurations.nodes[0].match_123[0].testdata"│
╞══════════════════════════════════════════════════════════════╡
│"c:a:gksu-polkit_project:gksu-polkit::::::::" │
└──────────────────────────────────────────────────────────────┘

```

---

<div class="post-metadata">

**Author:** ![koji](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/koji/32/27564_2.png) [@koji](https://community.neo4j.com/u/koji)\
**Post date:** [December 20, 2019, 8:47pm UTC](https://community.neo4j.com/t/problem-importing-json/13019/3 "2019-12-20T20:47:37Z")

</div>

You can use backticks for names that begin with a number.

```auto
123_match[0] to `123_match`[0]

```

```auto
UNWIND ['test.json'] as filename
CALL apoc.load.json(filename) YIELD value AS v
RETURN v.ABC_Items[0].configurations.nodes[0].`123_match`[0].testdata

```

```auto
v.ABC_Items[0].configurations.nodes[0].`123_match`[0].testdata
"c:a:gksu-polkit_project:gksu-polkit::::::::"

```

[https://neo4j.com/docs/cypher-manual/current/syntax/naming/](https://neo4j.com/docs/cypher-manual/current/syntax/naming/)

---

<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 21, 2019, 12:15pm UTC](https://community.neo4j.com/t/problem-importing-json/13019/4 "2019-12-21T12:15:46Z")

</div>

Thanks, forgot about backticks 🙂
