{"id":6175,"date":"2015-09-07T16:15:26","date_gmt":"2015-09-07T13:15:26","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=6175"},"modified":"2015-08-31T09:28:51","modified_gmt":"2015-08-31T06:28:51","slug":"neo4j-loading-json-documents-with-cypher","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/","title":{"rendered":"Neo4j: Loading JSON documents with Cypher"},"content":{"rendered":"<p>One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we can still get JSON data into the graph.<\/p>\n<p><a href=\"http:\/\/gist.asciidoctor.org\/?dropbox-14493611%2Fblog%2Fadoc%2Fload_json.adoc\">Michael shows how to do this from various languages in this blog post<\/a> and I recently wanted to load a JSON document that I generated from <a href=\"http:\/\/gis.chicagopolice.org\/clearmap_crime_sums\/crime_types.html\">Chicago crime types<\/a>.<\/p>\n<p>This is a snippet of the JSON document:<\/p>\n<pre class=\" brush:js\">{\r\n    \"categories\": [\r\n        {\r\n            \"name\": \"Index Crime\", \r\n            \"sub_categories\": [\r\n                {\r\n                    \"code\": \"01A\", \r\n                    \"description\": \"Homicide 1st &amp; 2nd Degree\"\r\n                }\r\n            ]\r\n        }, \r\n        {\r\n            \"name\": \"Non-Index Crime\", \r\n            \"sub_categories\": [\r\n                {\r\n                    \"code\": \"01B\", \r\n                    \"description\": \"Involuntary Manslaughter\"\r\n                }\r\n            ]\r\n        }, \r\n        {\r\n            \"name\": \"Violent Crime\", \r\n            \"sub_categories\": [\r\n                {\r\n                    \"code\": \"01A\", \r\n                    \"description\": \"Homicide 1st &amp; 2nd Degree\"\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}<\/pre>\n<p>We want to create the following graph structure from this document:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/2015-07-23_06-46-50.png\"><img decoding=\"async\" class=\"aligncenter wp-image-6181 size-medium\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/2015-07-23_06-46-50-300x127.png\" alt=\"2015-07-23_06-46-50\" width=\"300\" height=\"127\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/2015-07-23_06-46-50-300x127.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/2015-07-23_06-46-50.png 598w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We can then connect the crimes to the appropriate sub category and write aggregation queries that drill down from the category.<\/p>\n<p>To do this we\u2019re going to have to pass the JSON document to Neo4j via its HTTP API rather than through the browser. Luckily there are <a href=\"http:\/\/neo4j.com\/developer\/language-guides\/\">drivers available for {insert your favourite language here}<\/a> so we should still be good.<\/p>\n<p>Python is my current goto language so I\u2019m going to use <a href=\"http:\/\/py2neo.org\/2.0\/\">py2neo<\/a> to load the data in.<\/p>\n<p>Let\u2019s start by writing a simple query which passes our JSON document in and gets it straight back. Note that I\u2019ve updated my Neo4j password to be \u2018foobar\u2019 \u2013 replace that with your equivalent if you\u2019re following along:<\/p>\n<pre class=\" brush:py\">import json\r\nfrom py2neo import Graph, authenticate\r\n\u00a0\r\n# replace 'foobar' with your password\r\nauthenticate(\"localhost:7474\", \"neo4j\", \"foobar\")\r\ngraph = Graph()\r\n\u00a0\r\nwith open('categories.json') as data_file:\r\n    json = json.load(data_file)\r\n\u00a0\r\nquery = \"\"\"\r\nRETURN {json}\r\n\"\"\"\r\n\u00a0\r\n# Send Cypher query.\r\nprint graph.cypher.execute(query, json = json)<\/pre>\n<pre class=\" brush:bash\">$ python import_categories.py\r\n   | document\r\n---+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n 1 | {u'categories': [{u'name': u'Index Crime', u'sub_categories': [{u'code': u'01A', u'description': u'Homicide 1st &amp; 2nd Degree'}, {u'code': u'02', u'description': u'Criminal Sexual Assault'}, {u'code': u'03', u'description': u'Robbery'}, {u'code': u'04A', u'description': u'Aggravated Assault'}, {u'code': u'04B', u'description': u'Aggravated Battery'}, {u'code': u'05', u'description': u'Burglary'}, {u'code': u'06', u'description': u'Larceny'}, {u'code': u'07', u'description': u'Motor Vehicle Theft'}, {u'code': u'09', u'description': u'Arson'}]}, {u'name': u'Non-Index Crime', u'sub_categories': [{u'code': u'01B', u'description': u'Involuntary Manslaughter'}, {u'code': u'08A', u'description': u'Simple Assault'}, {u'code': u'08B', u'description': u'Simple Battery'}, {u'code': u'10', u'description': u'Forgery &amp; Counterfeiting'}, {u'code': u'11', u'description': u'Fraud'}, {u'code': u'12', u'description': u'Embezzlement'}, {u'code': u'13', u'description': u'Stolen Property'}, {u'code': u'14', u'description': u'Vandalism'}, {u'code': u'15', u'description': u'Weapons Violation'}, {u'code': u'16', u'description': u'Prostitution'}, {u'code': u'17', u'description': u'Criminal Sexual Abuse'}, {u'code': u'18', u'description': u'Drug Abuse'}, {u'code': u'19', u'description': u'Gambling'}, {u'code': u'20', u'description': u'Offenses Against Family'}, {u'code': u'22', u'description': u'Liquor License'}, {u'code': u'24', u'description': u'Disorderly Conduct'}, {u'code': u'26', u'description': u'Misc Non-Index Offense'}]}, {u'name': u'Violent Crime', u'sub_categories': [{u'code': u'01A', u'description': u'Homicide 1st &amp; 2nd Degree'}, {u'code': u'02', u'description': u'Criminal Sexual Assault'}, {u'code': u'03', u'description': u'Robbery'}, {u'code': u'04A', u'description': u'Aggravated Assault'}, {u'code': u'04B', u'description': u'Aggravated Battery'}]}]}<\/pre>\n<p>It\u2019s a bit ugly but we can see that everything\u2019s there! Our next step is to extract each category into its own row. We can do this by accessing the \u2018categories\u2019 key in our JSON document and then calling the <cite><a href=\"http:\/\/neo4j.com\/docs\/stable\/query-unwind.html\">UNWIND<\/a><\/cite> function which allows us to expand a collection into a sequence of rows:<\/p>\n<pre class=\" brush:py\">query = \"\"\"\r\nWITH {json} AS document\r\nUNWIND document.categories AS category\r\nRETURN category.name\r\n\"\"\"<\/pre>\n<pre class=\" brush:bash\">$ python import_categories.py\r\n   | category.name\r\n---+-----------------\r\n 1 | Index Crime\r\n 2 | Non-Index Crime\r\n 3 | Violent Crime<\/pre>\n<p>Now we can create a node for each of those categories. We\u2019ll use the <cite>MERGE<\/cite> command so that we can run this script multiple times without ending up with repeat categories:<\/p>\n<pre class=\" brush:py\">query = \"\"\"\r\nWITH {json} AS document\r\nUNWIND document.categories AS category\r\nMERGE (:CrimeCategory {name: category.name}) \r\n\"\"\"<\/pre>\n<p>Let\u2019s quickly check those categories were correctly imported:<\/p>\n<pre class=\" brush:c\">match (category:CrimeCategory)\r\nreturn category<\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-23.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-6182\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-23.png\" alt=\"graph-23\" width=\"251\" height=\"237\" \/><\/a><\/p>\n<p>Looking good so far \u2013 now for the sub categories. We\u2019re going to use the <cite>UNWIND<\/cite> function to help us out here as well:<\/p>\n<pre class=\" brush:py\">query = \"\"\"\r\nWITH {json} AS document\r\nUNWIND document.categories AS category\r\nUNWIND category.sub_categories AS subCategory\r\nRETURN category.name, subCategory.code, subCategory.description\r\n\"\"\"<\/pre>\n<pre class=\" brush:bash\">$ python import_categories.py\r\n    | category.name   | subCategory.code | subCategory.description\r\n----+-----------------+------------------+---------------------------\r\n  1 | Index Crime     | 01A              | Homicide 1st &amp; 2nd Degree\r\n  2 | Index Crime     | 02               | Criminal Sexual Assault\r\n  3 | Index Crime     | 03               | Robbery\r\n  4 | Index Crime     | 04A              | Aggravated Assault\r\n  5 | Index Crime     | 04B              | Aggravated Battery\r\n  6 | Index Crime     | 05               | Burglary\r\n  7 | Index Crime     | 06               | Larceny\r\n  8 | Index Crime     | 07               | Motor Vehicle Theft\r\n  9 | Index Crime     | 09               | Arson\r\n 10 | Non-Index Crime | 01B              | Involuntary Manslaughter\r\n 11 | Non-Index Crime | 08A              | Simple Assault\r\n 12 | Non-Index Crime | 08B              | Simple Battery\r\n 13 | Non-Index Crime | 10               | Forgery &amp; Counterfeiting\r\n 14 | Non-Index Crime | 11               | Fraud\r\n 15 | Non-Index Crime | 12               | Embezzlement\r\n 16 | Non-Index Crime | 13               | Stolen Property\r\n 17 | Non-Index Crime | 14               | Vandalism\r\n 18 | Non-Index Crime | 15               | Weapons Violation\r\n 19 | Non-Index Crime | 16               | Prostitution\r\n 20 | Non-Index Crime | 17               | Criminal Sexual Abuse\r\n 21 | Non-Index Crime | 18               | Drug Abuse\r\n 22 | Non-Index Crime | 19               | Gambling\r\n 23 | Non-Index Crime | 20               | Offenses Against Family\r\n 24 | Non-Index Crime | 22               | Liquor License\r\n 25 | Non-Index Crime | 24               | Disorderly Conduct\r\n 26 | Non-Index Crime | 26               | Misc Non-Index Offense\r\n 27 | Violent Crime   | 01A              | Homicide 1st &amp; 2nd Degree\r\n 28 | Violent Crime   | 02               | Criminal Sexual Assault\r\n 29 | Violent Crime   | 03               | Robbery\r\n 30 | Violent Crime   | 04A              | Aggravated Assault\r\n 31 | Violent Crime   | 04B              | Aggravated Battery<\/pre>\n<p>Let\u2019s give sub categories the <cite>MERGE<\/cite> treatment too:<\/p>\n<pre class=\" brush:py\">query = \"\"\"\r\nWITH {json} AS document\r\nUNWIND document.categories AS category\r\nUNWIND category.sub_categories AS subCategory\r\nMERGE (c:CrimeCategory {name: category.name})\r\nMERGE (sc:SubCategory {code: subCategory.code})\r\nON CREATE SET sc.description = subCategory.description\r\nMERGE (c)-[:CHILD]-&gt;(sc)\r\n\"\"\"<\/pre>\n<p>And finally let\u2019s write a query to check what we\u2019ve imported:<\/p>\n<pre class=\" brush:c\">match (category:CrimeCategory)-[:CHILD]-&gt;(subCategory)\r\nreturn *<\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-24.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-6183\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-24.png\" alt=\"graph-24\" width=\"599\" height=\"302\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-24.png 599w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/graph-24-300x151.png 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/a><\/p>\n<p>I hadn\u2019t realised before running this query is that some sub categories sit under multiple categories so that\u2019s quite an interesting insight. The <a href=\"https:\/\/github.com\/mneedham\/neo4j-spark-chicago\/blob\/master\/import_categories.py\">final Python script<\/a> is available on github \u2013 any questions let me know.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.markhneedham.com\/blog\/2015\/07\/23\/neo4j-loading-json-documents-with-cypher\/\">Neo4j: Loading JSON documents with Cypher<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Mark Needham at the <a href=\"http:\/\/www.markhneedham.com\/blog\/\">Mark Needham Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we can still get JSON data into the graph. Michael shows how to do this from various languages in this blog post and I recently wanted to load &hellip;<\/p>\n","protected":false},"author":48,"featured_media":1651,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[222,40,80],"class_list":["post-6175","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-cypher","tag-json","tag-neo4j"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-07T13:15:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mark Needham\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Needham\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\"},\"author\":{\"name\":\"Mark Needham\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e\"},\"headline\":\"Neo4j: Loading JSON documents with Cypher\",\"datePublished\":\"2015-09-07T13:15:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\"},\"wordCount\":416,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"keywords\":[\"Cypher\",\"JSON\",\"Neo4j\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\",\"name\":\"Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"datePublished\":\"2015-09-07T13:15:26+00:00\",\"description\":\"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Neo4j: Loading JSON documents with Cypher\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e\",\"name\":\"Mark Needham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g\",\"caption\":\"Mark Needham\"},\"sameAs\":[\"http:\/\/www.markhneedham.com\/blog\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/mark-needham\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026","description":"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/","og_locale":"en_US","og_type":"article","og_title":"Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026","og_description":"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we","og_url":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-09-07T13:15:26+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","type":"image\/jpeg"}],"author":"Mark Needham","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Mark Needham","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/"},"author":{"name":"Mark Needham","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e"},"headline":"Neo4j: Loading JSON documents with Cypher","datePublished":"2015-09-07T13:15:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/"},"wordCount":416,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","keywords":["Cypher","JSON","Neo4j"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/","url":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/","name":"Neo4j: Loading JSON documents with Cypher - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","datePublished":"2015-09-07T13:15:26+00:00","description":"One of the most commonly asked questions I get asked is how to load JSON documents into Neo4j and although Cypher doesn\u2019t have a \u2018LOAD JSON\u2019 command we","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/python\/neo4j-loading-json-documents-with-cypher\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/www.webcodegeeks.com\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Neo4j: Loading JSON documents with Cypher"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/848a54e2ee724e46069ce36c2e52e98e","name":"Mark Needham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5489baed26ce2d932bf951ecfb47afe80bec45d3648c23521d87c83b8f1c3ea9?s=96&d=mm&r=g","caption":"Mark Needham"},"sameAs":["http:\/\/www.markhneedham.com\/blog\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/mark-needham\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/6175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/48"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=6175"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/6175\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/1651"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=6175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=6175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=6175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}