title: Neo4j - Create Nodes from nested JSON file and list
body: <p>I am new to Neo4j and especially with Cypher query. I am trying to create nodes for the values in the JSON file as you can see its in a nested format. Using <code>MERGE</code> because I need the values like 'Adam Smith' as a single node from the nested list below. It clearly works well when 'organization' is not in nested/list format. Please see below of my try out and comments. Really appreciate the help!</p>
  
  <p>Sample data.json</p>
  
  <pre><code>[   {   'organization': 'MIT',
          'student_names': ['Adam Smith'],
          'unique_id': 'ABC123'},
      {   'organization': 'Harvard',
          'student_names': ['Adam Smith', 'Cate Scott'],
          'unique_id': 'ABC124'},
      {   'organization': 'Harvard',
          'student_names': ['Mandy T.', 'Bob Smith'],
          'unique_id': 'ABC125'}]
  </code></pre>
  
  <p>Creates 2 nodes for organization - works</p>
  
  <pre><code>CALL apoc.load.json('file:///data.json') YIELD value as v 
  MERGE (o:org {name: v.organization})
  // Added 2 labels, created 2 nodes, set 2 properties, completed after 5 ms.
  </code></pre>
  
  <p>Doesn't work</p>
  
  <pre><code>CALL apoc.load.json('file:///data.json') YIELD value as v 
  UNWIND v.student_names as s
  MERGE(st:student {name: s.student_names})
  </code></pre>
  
  <p>Error: <code>Neo.ClientError.Statement.TypeError: Type mismatch: expected a map but was String("Adam Smith")</code></p>
  
  <p>Looking for a graph untangled like this. I think I can define the relation on my own, I am just looking to see how to create nodes to begin with. </p>
  
  <pre><code>ABC123 --&gt; MIT --&gt; Adam Smith 
  ABC124 --&gt; Harvard --&gt; Adam Smith
  ABC124 --&gt; Harvard --&gt; Cate Scott
  ABC125 --&gt; Harvard --&gt; Mandy T.
  ABC125 --&gt; Harvard --&gt; Bob Smith
  </code></pre>