Its asp.net mvc paradigm. i have a Prices property on model that is an IList
of type VMPrice
. in view i do something like
<%var serializer = System.Web.Script.Serialization.JavaScriptSerializer();%>
<script type="text/javascript">
var prices = '<%:serializer.Serialize(Model.Prices)%>';
alert(prices);
prices = $.parseJSON(prices); // This line throws exception Invalid Json object
</script>
The alert call on fourth line shows following string
[{"SKUID":3,"ExFactoryPrice":765.00},{"SKUID":5,"ExFactoryPrice":39.91}]
can someone explain what's the problem here and how to get around this.
regards