I believe the issue is caused because you are returning a JsonObject
and not a String
. Serializing the JsonObject
needs, by default, to return enough information to be able to recreate it on de-serialization.
You can either use a JsonWriter
to convert it to a String
and return that or, better yet, create a local static class with your fields and simply return the object. Since your method is marked as returning JSON, Jersey/Jackson will automatically serialize your object for you. Depending on your Jackson settings, you may need to annotate your class so Jackson knows what to do with it.
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
private static class MyReturn {
String hello;
String name;
UUID id;
int age;
}