Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-27-2019 01:33 PM
Can you please help me on this?
I have Object type of Node like:
<Node id=1 labels={'First'} properties={'foo': 'foo', 'bar': 'bar'}>
I have tried to use like:
Response(dumps(res), mimetype="application/json")
But it throws an error:
TypeError: Object of type Node is not JSON serializable
Solved! Go to Solution.
04-27-2019 03:09 PM
Hi there!
Which library are you using? If the official Neo4j Driver for Python (Bolt), I think it is correct that Node
s are not JSON serializable. You can retrieve the properties and labels from the Node (https://neo4j.com/docs/api/python-driver/current/types/graph.html) and then build up a standard list/dict and convert that to JSON with json.dumps().
Hope that helps!
Cheers,
-Ryan
04-27-2019 03:09 PM
Hi there!
Which library are you using? If the official Neo4j Driver for Python (Bolt), I think it is correct that Node
s are not JSON serializable. You can retrieve the properties and labels from the Node (https://neo4j.com/docs/api/python-driver/current/types/graph.html) and then build up a standard list/dict and convert that to JSON with json.dumps().
Hope that helps!
Cheers,
-Ryan
04-27-2019 10:44 PM
Yes, I'm using the official Neo4j Driver for Python. According to you, it's more complicated to grab one by one that is Node.id, Node.labels, etc. Isn't there a way to grab all of them to convert into list/dict?
If not anyways, I'm going to build it manually.
Thanks
07-05-2021 02:14 PM
Did you find any solution? For python I read that json serialization blows up because JS can't handle bignums, but not sure about python, I find the serialization can be picky there anyway.
Manually pulling out properties and converting seems like a lot of work...
There seems to be a JSON exporter for neo4j
All the sessions of the conference are now available online