0

我正在尝试将这些数据解析为 C# 中的强类型类:

a:6:{s:15:"info_buyRequest";a:5:{s:4:"uenc";s:140:"aHR0cDovL2xvY2FsaG9zdC9JbnRlZ3JhdGlvbnMvbWFnZW50by9pbmRleC5waHAvY29hbGVzY2UtZnVuY3Rpb25pbmctb24taW1wYXRpZW5jZS10LXNoaXJ0Lmh0bWw_X19fU0lEPVU,";s:7:"product";s:3:"119";s:15:"related_product";s:0:"";s:15:"super_attribute";a:1:{i:525;s:3:"100";}s:3:"qty";s:1:"2";}s:15:"attributes_info";a:1:{i:0;a:2:{s:5:"label";s:4:"Size";s:5:"value";s:5:"Small";}}s:11:"simple_name";s:43:"Coalesce: Functioning On Impatience T-Shirt";s:10:"simple_sku";s:7:"coal_sm";s:20:"product_calculations";i:1;s:13:"shipment_type";i:0;}

我尝试了 WEB API,但是,它说这是无效的 JSON。

它保存在产品选项列下的sales_flat_order_item表中。

4

1 回答 1

0

谢谢。我使用了 Sharp PHP 序列化库。

http://sourceforge.net/projects/csphpserial/

这是我的代码:

Hashtable ht = (Hashtable)this.serializer.Deserialize(this.serializeTextBox.Text);

            foreach (DictionaryEntry entry in ht)
            {
                if (entry.Key.ToString() == "attributes_info")
                {
                    ArrayList all = (ArrayList)ht["attributes_info"];
                    Hashtable all2 = (Hashtable)all[0];
                    string value = all2["value"].ToString();
                }
            }
于 2013-05-29T14:15:06.000 回答