Json serialization if IEnumerables with JavaScriptSerializer RRS feed

  • General discussion

  • I just hit a (to me) surprising behaviour of the JavaScriptSerializer, in that it serializes any IEnumberable as an array. I quite often define things like

    Interface IFoo : IEnumerable<Bar> {
      int MyFoo {get;}
      string Wibble {get;}
      DateTime Wobble {get;}

    I was quite surprised this got serialized as a JS array of Bars. Is this considered reasonable behaviour? Should it change? What do others think about this?

    Monday, February 10, 2014 2:55 PM

All replies