0

assume that I have class like this

public class Entity {
    private String name;
    private File file;

    // Getters & setters
}

is it possible to return object of this class as json? I'm using jax-rs

Benq
  • 13
  • 3
  • This question is already answered on Stack Overflow: https://stackoverflow.com/questions/34485420/how-do-you-put-an-image-file-in-a-json-object/34485762 – attacomsian Jun 09 '18 at 14:49
  • To be honest, I didn't found answer for my question – Benq Jun 09 '18 at 15:41

1 Answers1

0

Yes, you can.

If you're using JAX-RS, then I expect you to know the basic of creating a REST-ful Web Services ya.

You can use @Produces("application/json") annotation in one of your endpoint. Use that endpoint to return an Entity, and it will be automatically converted as JSON.

Yosi Pramajaya
  • 3,895
  • 2
  • 12
  • 34