cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Exporting json that has a structure constructed from elements matched in DB

I have a graph structure that looks like the one on the left and I need a json file with the structure to the right

the purpose is to get a list of counties with , for each of them, the corresponding list of collectives names, with optional attached details (url by type - facebook, twitter or website and email address)

here is for example how county n°13 looks like in DB : it has 3 collectives attached. Urls are the green nodes , an email address is node with property thgType="email adress"

do I need to create , in the DB, the nodes and relations corresponding to the structure I want to export ?

if so, how do I do that ? i've been struggling with foreach, unwind, create, call , ... and could figure it out !

do I need apoc.convert.toJson ? cause I got this error trying to use id

Failed to invoke function `apoc.convert.toJson`: Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.neo4j.graphdb.Label$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0]->org.neo4j.kernel.impl.core.NodeEntity["labels"]->java.util.ArrayList[0])

any hint on how to construct a new structure by picking elements in DB highly appreciated !

(tried my best to make the question clear, but please ask if it is not ... )

2 REPLIES 2

D_C
Node Clone

I'm also looking into serialization. Did you get the apoc function to work in the end?
What language are you using?

From python I think you can just do result.dict() but you still have to reformat the results.

Did you review these posts about using subgraph and apoc.convert ?

what I was missing at the time is the use of collect() which basically is all I needed

I've presented how it's done here https://youtu.be/-mtFqb2U6Sc?t=2450

the details are presented here http://www.e-tissage.net/nodes2020-using-cypher-to-extend-a-graph-based-documentation/

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online