How can I add an image file into json object?

后端 未结 3 1905
失恋的感觉
失恋的感觉 2020-11-28 03:58

I want to add an image file into json object . Is it possible to add image file into json object?

I tried below code but its not working ? Because i want to send tha

3条回答
  •  一个人的身影
    2020-11-28 04:46

    You will need to read the bytes from that File into a byte[] and put that object into your JSONObject.

    You should also have a look at the following posts :

    • ByteArray in JSON
    • Binary Data in JSON String. Something better than Base64
    • BSON library for java

    Hope this helps.

提交回复
热议问题