Closed hhblaze closed 6 years ago
In looking at your object. You don't have "Enabled" in your netjson.txt string. And since you have a constructor that initialize the YadroUser object which set Enabled = true. It will be true by default.
Since this is the step that occurs during deserialization.
Thanx, I see that....was a bit overloaded.... it's xml tag... closing the issue
Np. 👍
In total this problem appeared, because default boolean (and probably other types) value is not storing together with the JSON object. I couldn't implement the idea that after initializing class YadroUser (from NetJsonObj.txt) the default value for "Enabled" must be set to true, by setting it up in constructor. It was set to "Enabled"= false within the program and saved without that JSON property. On reading from DB it was set to "True" value and not overriden with false, because there was no such JSON property. Very unhandy. Probably, there should be (or there is) a NetJSON flag that tells to store all values, even default? In my case disk space doesn't play much role, so I would use that. More of it, IMHO, this option must be set by default to "full-save".
The option to not skip default exists. Here https://github.com/rpgmaker/NetJSON/wiki/Quick-Guide .
You need to set skipDefualt to false in the settings object.
Thanks,
Mystical persecution continues: now I got following object (see attached files netjson.txt netjsonObj.txt
) and while deserialization I still have "Enabled" = true
I will look into it.
Thanks,
It is fixed. I will create a new nuget package once i fix the other two issues. Thanks
It is published on nuget and should be available soon.
Very nice, thank you!
NetJSON versions 1.2.7 Object can be deserialized but shows incorrect boolean value.
File netjson.txt contains generated (by NetJSON) a JSON-string - serialized object YadroUser from attached file netjsonObj.txt.
Reproducing:
Value "Enabled" after deserialization is true, though must be false.
netjson.txt netjsonObj.txt