Search code examples
memgraphdb

How to fix mgp.Vertex.properties not JSON serializable?


I am creating a query module in Memgraph and I am creating a dictionary for every node in the database. I am trying to add properties of a node as a list to my properties key, but then I get mgp.Vertex.properties not JSON serializable error. What is the best way to solve this?


Solution

  • This is happening because mgp objects are not JSON serializable, and there is a feature request opened for that. But, to avoid such error for now, you can do similar to what is implemented in the export_util.py query module. You iterate over all properties for every node and depending on the property type, set value for every key.