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
,但在执行列表时显示为空。
答案 0 :(得分: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();