Search code examples
jsonneo4jjson.netneo4jclient

How to get result from Cypher Query in json using Neo4j C# Client


i am using Neo4j 2.0.3 DB and using C# client to access neodb. I could not find any way by which after querying db i can get results in the form of Json. Please give me some links or examples


Solution

  • You can get Cypher Query results in JSON format

    eg. Consider a graph with person nodes and nodes have property personId. The below query will give you result in the form of json object.

    MATCH (n:PERSON)-[:friend]->(friend:PERSON) RETURN {personId: n.personId, friends: collect(distinct friend.personId)} as PersonData
    

    Now you have the json string. Now using this or anyother way you can get it in an object