title: After saving byte array to BLOB, how to convert it to string, when getting data?
body: <p>In my Oracle table I am using a BLOB field to save the byte array which is originally a JSON string from user input on page. </p>
  
  <p>For example, this is what the client passes to the server: </p>
  
  <blockquote>
    <p>"{'AD_ID_NBR':'440111111111177777'}" </p>
  </blockquote>
  
  <p>On the server side, it will be converted to a byte array and stored into BLOB.</p>
  
  <pre><code>byte[] bytes = input.getUserInput();//userInput is byte[]
  ps.setBlob(2, new ByteArrayInputStream(bytes));
  </code></pre>
  
  <p>When returning the user input to the client side, I need to do the reverse.</p>
  
  <pre><code>input.setUserInput(rs.getBlob("USER_INPUT").getBytes(1l, (int)rs.getBlob("USER_INPUT").length()));
  </code></pre>
  
  <p>Then on the client side I will get :</p>
  
  <blockquote>
    <p>"userInput": "eydBRF9JRF9OQlInOic0NDAxMTExMTExMTExMjIyMjInfQ==" </p>
  </blockquote>
  
  <p>Obviously it is not what I need. Some conversion should be done here.</p>
  
  <p>My question is how to convert this string into the json string that I had saved before. Thanks.</p>