'How to create FileDataBodyPart from a JSONObject?
I am trying to invoke a multipart/form-data request which is accepting a FileDataBodyPart (application/json) as parameter using Jersey client. At client-side, I have the input data in the form of JSONObject. Is there a way to convert the given JSONObject to type File(in-memory) so that I can create and send FileDataBodyPart to server?
I have tried it with StreamDataBodyPart with media type as application/json also, which is returning BAD_REQUEST(400). I also tried creating temporary in-memory file from JSONObject, but the the input parameter shows null data at server-side.
Please ignore any format or language related mistake. Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
