Understanding the CALL apoc.... and what it yields

Hi all,
newbie warning!!!! :grinning:
So I created a set of nodes and then exported the data to a .json file
I am using version 4.2.3 and APOC 4.201
Now I have deleted my data and am importing the json back. (my current exercise)
The data looks like

[
  {
    "n": {
      "identity": 0,
      "labels": [
        "FEMALE"
      ],
      "properties": {
        "pid": "92",
       "xref": "9999",
      }
    }
  }, ......................etc

However, I can import and create the nodes but the is no data

{
  "identity": 2,
  "labels": [
    "Person"
  ],
  "properties": {

  }
}

My code looks like

CALL apoc.load.json("files:/home/XXX/.local/share/neo4j-relate/dbmss/dbms-3d3a0cbb-e84d-4ea0-a5b9-b53c63c9f44c/import/exportData.json")
YIELD value AS n  //values in file
CREATE (p:Person {pid: n.pid})
SET p.name = n.name,
    p.ref = n.ref,
    p.xref = n.xref

Maybe I do not understand?
After the call the YIELD return a set of n (as per the code) - is this a list?
To create the p:Person I use CREATE as per the code and SET the other properties... but with a null result.

I have learning through the cybertext and youtube videos - however some of the videos are of older neo4j versions and there seems to be differences

  1. Is my understanding that the YIELD results in a set? and the CREATE then processes that set iteratively?

  2. What is wring with my code - I am missing something

Thanks in advance

firstly simplify the code and run

CALL apoc.load.json("files:/home/XXX/.local/share/neo4j-relate/dbmss/dbms-3d3a0cbb-e84d-4ea0-a5b9-b53c63c9f44c/import/exportData.json")
YIELD value AS n  return n;

do you get expected values? Is it able to read the exportData.json? i'm also not sure if file:/ should not be file:///

I get a list of elements in the table
So it does work to this point.
However, the issue arises at

CREATE (p:Person {pid: n.pid})
SET p.name = n.name,
    p.ref = n.ref,
    p.xref = n.xref

I have no data in the db

The name is always failed as null. Yet there is data.
It seems the exported JSON is a streaming JSON, perhaps that is the problem?
It will create a single node as Person with just the id().

@ dana.canzano
To start from scratch I do the following:

CREATE (p:Person {name:"Stream1", category:"Fit", user1:"Paul", user2:"Able", weight: "100"});
CREATE (p:Person {name:"Stream2", category:"Fat", user1:"Peter", user2:"John", weight: "2000"});

I export to person.json and it looks like this:
```
[
{
"n": {
"identity": 15,
"labels": [
"Person"
],
"properties": {
"user1": "Paul",
"name": "Stream1",
"user2": "Able",
"weight": "100",
"category": "Fit"
}
}
},
{
"n": {
"identity": 16,
"labels": [
"Person"
],
"properties": {
"user1": "Peter",
"name": "Stream2",
"user2": "John",
"weight": "2000",
"category": "Fat"
}
}
}
]

when I invoke 

WITH "files:/home/XXXX/.local/share/neo4j-relate/dbmss/dbms-4be8457c-f913-41ce-8d8a-177764737dde/import/person.json" AS path2json
CALL apoc.load.json(path2json)
YIELD value AS n //values in file
MERGE (p:pperson {name: n.name})
ON CREATE SET //p.name = n.name,
p.user1 = n.user1,
p.weight = n.weight

then I receive the failure
Cannot merge the following node because of null property value for 'name': (:pperson {name: null})

can you rerun as

CALL apoc.load.json("files:/home/XXX/.local/share/neo4j-relate/dbmss/dbms-3d3a0cbb-e84d-4ea0-a5b9-b53c63c9f44c/import/exportData.json")
YIELD value AS n  return n.name, n.pid, n.ref, n.xref

do you get expected values?

with the example Person.json previously provided

call apoc.load.json('file:///person.json') yield value as Persons return Persons.n.identity, Persons.n.properties.user1, Persons.n.properties.name, Persons.n.properties.weight,Persons.n.properties.category;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| Persons.n.identity | Persons.n.properties.user1 | Persons.n.properties.name | Persons.n.properties.weight | Persons.n.properties.category |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| 15                 | "Paul"                     | "Stream1"                 | "100"                       | "Fit"                         |
| 16                 | "Peter"                    | "Stream2"                 | "2000"                      | "Fat"                         |
+-------------------------------------------------------------------------------------------------------------------------------------------+

which is simply getting said values from the json. from here you can then do the create/merge as desired

Well it turns out the solution is that the JSON tree walking failed me so here is the solution.

WITH "files:///home/XXXX/.local/share/neo4j-relate/dbmss/dbms-4be8457c-f913-41ce-8d8a-177764737dde/import/person.json" AS path2json
 CALL apoc.load.json(path2json)
 YIELD value AS Persons //values in file
 UNWIND Persons.n.labels AS qPerson
 
MERGE (p:qPerson {name:Persons.n.properties.name})
ON CREATE SET p.identity = Persons.n.identity,
//special case array    Persons.n.labels,
    		  p.user1 = Persons.n.properties.user1,
			  //p.name = Persons.n.name,
		      p.weight = Persons.n.properties.weight,
			  p.category = Persons.n.properties.category

Thanks to @dana.canzano for guidance

How were you creating the json file? for if you were using APOC and Export to JSON - APOC Documentation this should be simpler