# Property with apoc.map as data structure

**URL:** <https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022>\
**Category:** Procedures & APOC\
**Created:** [February 24, 2020, 2:20pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022 "2020-02-24T14:20:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tideon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tideon/32/4351_2.png) [@tideon](https://community.neo4j.com/u/tideon)\
**Post date:** [February 24, 2020, 2:20pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/1 "2020-02-24T14:20:15Z")

</div>

Dear Everyone,

Neo4J 4.0  
Browser Desktop 4.0.3  
Operating system OSX Mojave

I have been reading about the use of Apoc maps for about a week, but none of the stuff I have watched or read actually use it in the query.

This page [https://neo4j.com/docs/labs/apoc/3.5/data-structures/map-functions/](https://neo4j.com/docs/labs/apoc/3.5/data-structures/map-functions/)  
gives examples of it with the return clause, but doesn't show me how to add it to a node as a property.

What I want to do is that the following.

I have an invoice that has sub invoices attached to it, so what I need to do is add the sub invoices as a a map in one of the properties.

The invoice is a reminder invoice so I want to add the two invoices to the node in a map in a variable, but the original invoices that are in the map I want to add as external nodes, The reason being to keep track of the originals in comparison to what they send on the reminder invoices. Will be used for comparisons down the line.

The information in the map will be key value pairs. I just don't understand as yet how to add the map to a property on a node. And also how to edit it later. I did read that Neo4J doesn't do edits on maps, so that is why I went and looked at APOC.

So here is a little example of what the data from the invoice looks like

InvoiceRefNR:1, Date:"09-02-2006", PricipalCost:33  
InvoiceRefNR:2, Date:"04-01-2006", PricipalCost:456

How do I add this information to the node as a property with the name InvoiceRefNR

So the main node is:  
**Label:** Invoice  
**Property:** RefNr  
**Property:** SubInv: (this will / needs to be a map of all the sub invoices)

I need to be able to access each sub invoice as it's own map. So I am alreay wondering if this will be a list of maps inside the SubInv property.

Bear in mind I am new to this, so the more detailed your explanation the better.

Thank you in advance.  
Tideon

---

<div class="post-metadata">

**Author:** ![intouch\_vivek](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/intouch_vivek/32/4097_2.png) [@intouch\_vivek](https://community.neo4j.com/u/intouch_vivek)\
**Post date:** [February 24, 2020, 3:55pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/2 "2020-02-24T15:55:51Z")

</div>

> [@tideon](#):
>
> an invoi

Hi Tideon.

Could you please give sample dataset with Invoice, subinvoice and their properties and relationships.

Regards  
Vivek

---

<div class="post-metadata">

**Author:** ![tideon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tideon/32/4351_2.png) [@tideon](https://community.neo4j.com/u/tideon)\
**Post date:** [February 24, 2020, 7:22pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/3 "2020-02-24T19:22:38Z")

</div>

Hello Vivek,

Thank you for responding. How would I do that?

Do you mean for me to write it out?

Kind regards,  
Tideon

---

<div class="post-metadata">

**Author:** ![intouch\_vivek](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/intouch_vivek/32/4097_2.png) [@intouch\_vivek](https://community.neo4j.com/u/intouch_vivek)\
**Post date:** [February 25, 2020, 12:39pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/4 "2020-02-25T12:39:24Z")

</div>

Hi Tideon,

If you provide me sample dataset and exact requirement that will be help me to visualize and apply the logic

Regards  
Vivek

---

<div class="post-metadata">

**Author:** ![tideon](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tideon/32/4351_2.png) [@tideon](https://community.neo4j.com/u/tideon)\
**Post date:** [February 25, 2020, 12:41pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/5 "2020-02-25T12:41:59Z")

</div>

Hello Vivek,

What are the steps to create the dataset?

I'm still new to Neo4J.

Kind regards,  
Tideon

---

<div class="post-metadata">

**Author:** ![anthapu](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/anthapu/32/4113_2.png) [@anthapu](https://community.neo4j.com/u/anthapu)\
**Post date:** [February 25, 2020, 12:53pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/6 "2020-02-25T12:53:32Z")

</div>

Hi Tideon,  
You cannot set a map as property on node. That's not supported. You need to convert it to string and set it as a property. When you are reading you can convert it back to map.

See the documentation

[https://neo4j.com/docs/labs/apoc/current/overview/](https://neo4j.com/docs/labs/apoc/current/overview/)

Methods to look at

```auto
apoc.convert.setJsonProperty

apoc.convert.getJsonProperty

```

---

<div class="post-metadata">

**Author:** ![intouch\_vivek](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/intouch_vivek/32/4097_2.png) [@intouch\_vivek](https://community.neo4j.com/u/intouch_vivek)\
**Post date:** [February 25, 2020, 1:20pm UTC](https://community.neo4j.com/t/property-with-apoc-map-as-data-structure/15022/7 "2020-02-25T13:20:33Z")

</div>

@tideon , Yes @anthapu is correct we cannot create map as node/relationship property.

However if you provide the sample csv file/json file that you are trying to insert and tell us the exact requirement then hopefully we can assist you

Regards  
Vivek
