JSONitem.ToString in the Debugger

Necro’ing Mike D’s old post

with new information, in case it helps someone in the future. I was experiencing the same issue and found that the problem lay in the fact that the keys and values I was assigning to my JSONItem using the Value method had come via a BinaryStream and hence had no or incorrect encoding.

The JSONItem actually worked in my code, I just couldn’t see its contents in the debugger’s ToString view, and accessing its ToString caused an exception. After converting the keys’ and values’ encoding to UTF-8 prior to using Value, all works as expected.