Hello,
I am new in Neo4j. I am trying to import a json(schema) file in order to see the data in the graph.
The json file looks like this:
{
"data": {
"id": "3124test2134",
"information": [
{
"name": "info name",
"tags": ["tag1", "tag2"]
}
]
}
}
When I write this:
CALL apoc.load.json("file:/data.json") YIELD value
UNWIND (CASE value.data.information WHEN [] THEN [null] ELSE value.data.information END) AS info
UNWIND (CASE value.data.information.tags WHEN [] THEN [null] ELSE value.data.information.tags END) AS tags
RETURN tags
I have this result:
│"info" │"tags" │
│{"name":"info name","tags":["tag1","tag2"]}│"tag1" │
│{"name":"info name","tags":["tag1","tag2"]}│"tag2" │
But I want something like this:
│"info" │"tags" │
│ │ │
│{"name":"info name","tags":["tag1","tag2"]}│"tag1" │
│ │"tag2" │
So I can have 1 row for info and 2 rows for tags. Is there any way to do that?
I have a problem later in the code when I want to create nodes. it creates 2 nodes instead of 1.
Thank you very much in advance!
/Angelos