0

JSON字符串:

 { "Result": 
           [
                { "food_photo":255,216,255,224,0,16,74,70,73,70,0,1.....4,255,217],
                  "qty":"12",
                  "time":"23",
                  "cost":null
                }
           ]
   }

我的问题:如何转换food_photo成列表?

仅供参考:我public byte[] food_photo在课堂上使用,但是当我执行我的列表时它显示为 null。

4

1 回答 1

1

尝试将 food_photo 反序列化为字符串并使用 string.split 方法

string deserializedFoodPhoto = "255,216,255,224,0,16,74,70,73,70,0,4,255,217";
var photoInList = deserializedFoodPhoto.Split(',').Select(i => byte.Parse(i)).ToList();
于 2012-11-08T10:21:27.980 回答