JavaScriptSerializer - JSON serialization of enum as string
JavaScriptSerializer - JSON serialization of enum as string
JavaScriptSerializer - JSON serialization of enum as string
Re: JavaScriptSerializer - JSON serialization of enum as string
No there is no special attribute you can use. `JavaScriptSerializer` serializes `enums` to their numeric values and not their string representation. You would need to use custom serialization to serialize the `enum` as its name instead of numeric value.
If you can use JSON.Net instead of `JavaScriptSerializer` than see [answer on this question](https://stackoverflow.com/a/2870420/477420) provided by [Omer Bokhari](https://stackoverflow.com/users/56829/omer-bokhari): JSON.net covers this use case (via the attribute `[JsonConverter(typeof(StringEnumConverter))]`) and many others not handled by the built in .net serializers. [Here is a link comparing features and functionalities of the serializers](https://www.newtonsoft.com/json/help/html/JsonNetVsDotNetSerializers.htm).
If you can use JSON.Net instead of `JavaScriptSerializer` than see [answer on this question](https://stackoverflow.com/a/2870420/477420) provided by [Omer Bokhari](https://stackoverflow.com/users/56829/omer-bokhari): JSON.net covers this use case (via the attribute `[JsonConverter(typeof(StringEnumConverter))]`) and many others not handled by the built in .net serializers. [Here is a link comparing features and functionalities of the serializers](https://www.newtonsoft.com/json/help/html/JsonNetVsDotNetSerializers.htm).