Bunny83 / SimpleJSON

A simple JSON parser in C#
MIT License
735 stars 294 forks source link

Inheritance broken? #17

Closed wvdvegt closed 6 years ago

wvdvegt commented 6 years ago

Hi

I'm using simpleJSON to cache some name value pairs.

My declaration is

private static JSONNode names = new JSONObject();

However when i call

names["id"] = "value";

all I see is virtual methods of JSONNode being called (as if class hierarchy is broken). Not sure that is the intended behavior. I fixed it for now by:

private static JSONObject names = new JSONObject();

Bunny83 commented 6 years ago

I can't reproduce this issue. I just created a private static JSONNode variable and use the same code as you. When i print out ToString(3) of that variable it correctly prints

{
   "id" : "value"
}
wvdvegt commented 6 years ago

I will have to look into it again. It worked when i replaced JSONNode by JSONObject, nu clue why it failed in the first place.

Btw i wrote a IValueConverter that allows you to use JSONNode in UWP databinding (it supports a converter parameter that supports very simple JSONPath syntax). Works quite nicely.