Error converting JSON to .Net object in asp.net

前端 未结 4 1675
滥情空心
滥情空心 2020-12-08 18:56

I am unable to convert JSON string to .net object in asp.net. I am sending JSON string from client to server using hidden field (by keeping the JSON object.Tostring() in hid

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 19:55

    If this is an array of arrays of JsonFeaturedOffers, shouldn't it be:

    byte[] byteArray = Encoding.ASCII.GetBytes(HdnJsonData.Value);
    MemoryStream stream = new MemoryStream(byteArray);
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonFeaturedOffer[][]));
    object result= serializer.ReadObject(stream);
    JsonFeaturedOffer[][] jsonObj = result as JsonFeaturedOffer[][];
    

提交回复
热议问题