Cypher convert to JSON of nodes and edges

Hi guys i'm trying to export to JSON dynamically based on Cypher.

MATCH (c:Claim)-[]->(a) WHERE c.claimID="6000" RETURN c, a

But I want to convert this to JSON of

nodes : [
{ 
id :
label/properties:
}]

edges: [
{
source:
target:
}]

Thank you in advance!

You'll need to get an alias on the relationships/edges if you want to include them in your json output, one approach to this is to construct a subgraph (copied from the linked post) -

MATCH (n) 
WHERE n.user_id='0000001'
CALL apoc.path.subgraphAll(n, {maxLevel:1}) YIELD nodes, relationships
WITH [node in nodes | node {.*, label:labels(node)[0]}] as nodes, 
     [rel in relationships | rel {.*, fromNode:{label:labels(startNode(rel))[0], key:startNode(rel).key}, toNode:{label:labels(endNode(rel))[0], key:endNode(rel).key}}] as rels
WITH {nodes:nodes, relationships:rels} as json
RETURN apoc.convert.toJson(json)

Original post & explanation -