Computed Property Names in Neo4j?

Hello everyone,
for a cypher statement that I am coding I would love to know whether there is a cypher functionality like in javascript's [ key ] : value.
I am querying an object which is build as followed:

{
          "Id": "Floor",
          "IdType": "string",
          "Value": "",
          "Unit": "none",
}

And I would like to have a result which is built with the node's property "Id" as key and the node's property "Value" as value:

{
    //Id : Value
    "Floor":  "XYZ"
}

Hi klug,
I hope this snippet of query can help you:

with obj.Id as keyName

match (n)
where n[keyName] is not null
with n,keyName,n[keyName] as value
with apoc.map.fromPairs([[keyName,value]]) as ns
return ns


1 Like

Thanks @filantrop! The apoc function fromPairs is the perfect fit for my problem.
Thanks for the fast and useful answer