@david_allen thanks for the above solution mate, much appreciated. I've tried to adopt it to my problem but am turning in circles and it is driving me mad ... would you please take a quick look at the below and let me know what I'm doing wrong?
Desired output ...
{
"JobWords": {
{
"IdInterface": "leader",
"NameInterfaceLower": "leader",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_leader"
},
{
"IdInterface": "founder",
"NameInterfaceLower": "founder",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_founder"
},
{
"IdInterface": "marketing",
"NameInterfaceLower": "marketing",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_marketing"
},
{
"IdInterface": "measurement",
"NameInterfaceLower": "measurement",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_measurement"
}
}
}
But the Cypher I am using ...
MATCH (Employee:Employee{IdObject:'xyz'})
WITH Employee
OPTIONAL MATCH (Employee)-[:LINKED_TO]->(:EmailAddress:Master)<-[:CONTAINED_IN|CONNECTED_TO]-(n:JobWord)
WHERE NOT n:Exclude
WITH Employee, n.IdUnique as key, {IdInterface: n.IdInterface, NameInterfaceLower: n.NameInterfaceLower, NameInterfaceOriginal: n.NameInterfaceOriginal, IdInterfaceTag: n.IdInterfaceTag} as value
WITH Employee, apoc.map.fromPairs(collect([key, value])) as job_words
RETURN
Employee {
JobWords: job_words
}
Only ever returns ...
{
"JobWords": {
"3e9ce5c6-6344-4cff-a80f-d4f7708e8e26": {
"IdInterface": "leader",
"NameInterfaceLower": "leader",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_leader"
},
"862ce5d8-651c-424b-b0c9-313c500ea266": {
"IdInterface": "founder",
"NameInterfaceLower": "founder",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_founder"
},
"4d1a76d7-44ba-462f-847b-5118599532bf": {
"IdInterface": "marketing",
"NameInterfaceLower": "marketing",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_marketing"
},
"373d5ec0-085b-4202-9631-a3c4585dd45c": {
"IdInterface": "measurement",
"NameInterfaceLower": "measurement",
"NameInterfaceOriginal": null,
"IdInterfaceTag": "job+word_measurement"
}
}
}
I've tried everything to get a list from just pairs without the nested part but no luck :( I must be missing something super obvious and simply cannot see it ...