Home

What is being dumped when expanding Json.NET scalar values?

edited August 2019
LINQPad Version: 5.40.0 Any CPU (beta)
Json.NET Version: 12.0.2

I noticed that when dumping Json.NET JObjects that have string values, it's rendered as an on-demand link. Clicking on it outputs an empty collection.



What exactly is being dumped here? It's just a string. Is this a bug?

edit:
It seems to do this for all scalar values actually.


Comments

  • JValue implements IFormattable, but also implements IEnumerable. So LINQPad creates a link whose text is IFormattable.ToString(), and when clicked, expands into the enumeration of IEnumerable.

    I might "fix" this in LINQPad 6 by special-casing the handling of Newtonsoft.JValue so that ignores the enumeration of IEnumerable if there are no members.
Sign In or Register to comment.