Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The serialiser gets confused which object to deserialize if type is dictionary.

See original GitHub issue

Following code works fine in first search when you cast node as dictionary as “root”, but if it’s assigned to property of anonymous or typed object, then it decides that your node is Node object and gets it’s properties. I think it might be related to v 1.1 change of return type of enumerator

void Main()
    var graph = new GraphClient(new Uri($"http://localhost:7474/db/data"), "neo4j", "neo4j");
    var r1 = new Dictionary<string, string>() { { "Id", "1" }, { "Name", "First" }};
       .Create("(node:Record {entity})")
       .WithParam("entity", r1)

    var result = graph.Cypher
                    .Where((Record node) => node.Id == "1")
                    .Return((node) => node.As<Dictionary<string, string>>() )

    var resultNode = graph.Cypher
                .Where((Record node) => node.Id == "1")
                .Return((node) => new { Record = node.As<Dictionary<string, string>>()})
resultNode.Dump()   ;           

public class Record
    public string Id { get; set; }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

cskardoncommented, Apr 18, 2016

I’m closing this as it looks like it’s gone to hibernation - any objections please reopen! ta!

cskardoncommented, Feb 17, 2016

In terms of your second question regarding what you’d pull back for ref=node-[r:Reference]-(rfr) the data back from Neo4j itself is a collection of Urls to the nodes and relationships, the default way to look at that is:


Problem for you is that you probably don’t want PathsResult instances, as that’s just links and pretty useless - what you’d be more after would be converting to Node/Relationship instances - I wrote a post a long time ago - but it should be still valid ( covering that aspect…

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How To Serialize a class that derives from a Dictionary
1 Answer. Because your dictionary has both a complex key and additional properties, you will need to use a custom JsonConverter to serialize ......
Read more >
Polymorphic Deserialization throws if $type metadata isn't ...
Attempting to deserialize a polymorphic structure with System.Text.Json that doesn't feature $type at start of the object results in an ...
Read more >
C# How to serialize/deserialize an Object to/from ...
If I want to store data as Document in Clouchbase.lite is has to be in the form of Dictionary like this: var properties...
Read more >
How to serialize and deserialize dictionaries using BitBuffer?
I want to serialize and deserialize a dictionary, but the dictionary is dynamic. The BitBuffer library I am using: GitHub - rstk/BitBuffer: Fast...
Read more >
What, Why and How of (De)Serialization in Python
The reversed process is called deserialization, which means reconverting a sequence of bytes into a structured object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found