Is there any way to JSON-serialize a List<T> subclass that has extra properties?
Ok, I have a simple class structure for hierarchical locations that look roughly like this...

    public class LocationList : List<Location>
    {
        private bool _IsExpanded;
        public bool IsExpanded
        {
            get { return _IsExpanded; }
            set { _IsExpanded = value; }
        }
    }

    public class Location
    {
        public string Name{ get; set; }
        public LocationList Locations{ get; set; }
    }

    public class ViewModel
    {
        public LocationList RootLocations{ get; set; }
    }

...and when I serialize them with JSON, it all works great, except the IsExpanded property on the LocationList class is excluded.  Only the list's contents are serialized.

Is there any way to serialize that IsExpanded flag natively?  If not, how would one write a converter to be able to read/write that value from JSON.

M
Is there any way to JSON-serialize a List<T> subclass that has extra properties?
===

Ok, I have a simple class structure for hierarchical locations that look roughly like this...

    public class LocationList : List<Location>
    {
        private bool _IsExpanded;
        public bool IsExpanded
        {
            get { return _IsExpanded; }
            set { _IsExpanded = value; }
        }
    }

    public class Location
    {
        public string Name{ get; set; }
        public LocationList Locations{ get; set; }
    }

    public class ViewModel
    {
        public LocationList RootLocations{ get; set; }
    }

...and when I serialize them with JSON, it all works great, except the IsExpanded property on the LocationList class is excluded.  Only the list's contents are serialized.

Is there any way to serialize that IsExpanded flag natively?  If not, how would one write a converter to be able to read/write that value from JSON.

M