目前我使用下面的方法,但我不喜歡它:將org.json.JSONObject轉換爲javax.sql.rowset.serial.SerialBlob的最佳方法是什麼?
JSONObject formJsonObj = new JSONObject();
formJsonObj.put("whatever", "whatever is inside");
ByteArrayOutputStream b = new ByteArrayOutputStream();
ObjectOutputStream o = new ObjectOutputStream(b);
o.writeObject(formJsonObj);
byte[] byteArray = b.toByteArray();
SerialBlob blob = new SerialBlob(byteArray);
有沒有更好的辦法?
必須有優於方式將Java序列化應用於JSON對象 – wero