1

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

Surjit Jana
  • 53
  • 1
  • 10

1 Answers1

3

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

Community
  • 1
  • 1
Sumeet Sharma
  • 2,573
  • 1
  • 12
  • 24
  • I have this code can you tell me how can i get json from this data dirctly without using json serializer using c#. client.Cypher.Match("(user:User)-[:WATCHES]->(programme:Programme)").Return((user, programme) => new { UserInfo = user.As(), Programme = programme.As() }).Results; – Surjit Jana Jul 16 '14 at 05:12
  • Why dont you try executing it as a whole cypher query instead of using Cypher.Match etc... You can form a cypher query and just run it and iterate through the result.. – Sumeet Sharma Jul 16 '14 at 07:35