Aug 25, 2009, 9:58 AM
[CLOSED] An empty string in a property with ClientConfig attribute not serialized
Hello,
Let's say I have a class as follows:
the Test property is not serialized at all and the resulting JSON is just "[{}]", which results in 'undefined' in JavaScript. I believe it should be "[{test:""}]". When a null value or any other non-empty string value is assigned to the Test property, it is serialized properly as "[{test:null}]" or "[{test:"test"}]".
Regards,
Tadeusz
Let's say I have a class as follows:
class BaseSettingTreeNode : TreeNode
{
public BaseSettingTreeNode()
{
}
[ClientConfig]
public string Test {get; set;}
}
When I serialize a tree nodes the following way:TreeNodeCollection nodes = new TreeNodeCollection( false );
nodes.Add(new BaseSettingTreeNode()
{
Test = string.Empty
});
var json = nodes.ToJson();
the Test property is not serialized at all and the resulting JSON is just "[{}]", which results in 'undefined' in JavaScript. I believe it should be "[{test:""}]". When a null value or any other non-empty string value is assigned to the Test property, it is serialized properly as "[{test:null}]" or "[{test:"test"}]".
Regards,
Tadeusz