Home  >  Q&A  >  body text

javascript - After wx.uploadFile uploads an image, our background returns an array, but WeChat changes it into something like this. How do I do this?

wx.uploadFile After uploading the image, our background returns an array, but WeChat changes it into the following. How do I do this?

"[ { "id" : 20332, "sign" : "image", "imagePath" : "http://139.224.206.114:8080/uploadFile/2017-04-21/image/7c1a2368-0f48-403b -8bc5-c00b6b266c13-7009.jpeg", "img-min" : "2017-04-21/image/7c1a2368-0f48-403b-8bc5-c00b6b266c13-7009-min.jpeg", "img-mid" : "2017 -04-21/image/7c1a2368-0f48-403b-8bc5-c00b6b266c13-7009-mid.jpeg", "img" : "/uploadFile/2017-04-21/image/7c1a2368-0f48-403b-8bc5-c00b6b266c13- 7009.jpeg", "fileName" : "tmp_984848017o6zAJsyHUyB0xEvz5oeVZNyoWXzgfb65df3db6bcc63c2d802c600adc02c3.jpeg", "code" : "10000", "msg" : 20332, "size" : 149780 } ]"

给我你的怀抱给我你的怀抱2711 days ago859

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:37:16


    What the WeChat API says is that it returns a String. You said that your background returns an array. WeChat converts the array into JSON format. You just need to reverse it

    res = JSON.parse(res.data);

    reply
    0
  • 高洛峰

    高洛峰2017-05-19 10:37:16

    Isn’t this JSON data?

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-19 10:37:16

    First of all, what you expressed is definitely wrong. wx.uploadFile() returns a mediaId, and then downloads the image through this mediaId,
    So your result should be the image you downloaded yourself and you should process the json information returned in the future, which means the information returned by your own server ,
    As for how you want to do it, I don’t know what you want to do?

    reply
    0
  • Cancelreply