0
我在身體參數解析字符串
[{"full_image":"alskdfhlkjasvbuialsdvlasljkvbaslvjhbalfdghbakjldfgjlajkshfiuqr","type":"jpg"},{"full_image": "alskdfhlkjasvbuialsdvlasljkvbaslvjhbalfdghbakjldfgjlajkshfiuqr","type":"jpg"}]
發送以下文字,然後分析它JSON.pasre
但我無法得到得到lenght
和循環使用JSON。以下是代碼。
var images = req.body.images;
JSON.parse(images, function(key,value){
var counter = key.length;
var seaWeedPicture = {};
var base64FullImage = value;
seaweedfs.write(new Buffer(base64FullImage, 'base64')).then(function (pic) {
var seaWeedPicture = {
picture: config.seaWeedURL + '/' + pic.fid
};
}).catch(function(err){
console.log(err);
res.format({
json: function() {
res.send({
status: 200,
data: []
});
}
});
});
產生的誤差是[TypeError: must start with number, buffer, array or string]
我僅僅指剛要循環的json,w帶着'seaweedfs'的禮儀文件並返回它的網址。 – Khan