0
public class Profile {
private String profId;
private byte[] image;
....
}

I debugged and everything is fine till I return the mav ( it has the byte array[])

[-119, 80, 78, 71, 13, 10, -26, 10, 0, 0, 0, 13, 73, 72, 68,...,46,89]

But when I checked the JSON response on browser it got string instead of array

{
"prof": {
      "profId": "Test123",
      "image": "-1198078711310-261000013737268...4689",
      "cretDt": "06-19-2013 12:16:25",
      "state": 6002,
      "stateName": "Approved"
    }
}

Join the byte.

Can some one help me hot to get the byte[] or encoded in Base64 again on my browser.

  • 1
    This might help you... https://stackoverflow.com/questions/20706783/put-byte-array-to-json-and-vice-versa – digidude Jun 23 '17 at 21:40
  • The problem esque spring joins the byte, will have to configure spring to send the bytes separated by some separator or send them in Base64. What is that configuration for spring? – Darwin Quiroz Jun 23 '17 at 21:47
  • 1
    What JSON library are you using? Spring usually uses [Jackson](https://github.com/FasterXML/jackson#jackson-project-home-github), which by default will generate Base64 for `byte[]`. – Andreas Jun 23 '17 at 22:17
  • wavemaker-json-6.7 – Darwin Quiroz Jun 23 '17 at 22:43

0 Answers0