Get data in graph format directly
gschurck opened this issue · 4 comments
gschurck commented
Is it possible to get the result of a cypher query in graph format directly, like in the HTTP API ?
For example to return the graph directly from the backend to display a graph visualization on the frontend.
fbiville commented
Hello, there is no built-in support for this.
If you need help implementing this, I'm happy to continue the conversation on Discord: https://neo4j.com/developer/discord/.
Once you get a Result
or ResultWithContext
, you'll need to call, in order:
Keys
- loop of (
Next
+Record
orNextRecord
) or justCollect
- if you're calling
Record
orNextRecord
, call and act upon the result ofErr
at the end of the iteration Consume
gschurck commented
Okay thank you.
gschurck commented
gschurck commented
Finally, I found that it's possible to export the graph data as JSON with cypher query directly
CALL apoc.export.json.all(null,{useTypes:true, stream: true, jsonFormat: "JSON"})
YIELD data
RETURN data
So it seems that it's the optimal way for an API to get neo4j graph data as JSON and return it directly in response.