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