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