MessageBodyWriter not found for media type=application/json

后端 未结 10 1641
庸人自扰
庸人自扰 2020-11-30 02:13

I am facing issues while consuming JAX-RS services as JSON.

Below I have added my code.

This is my service class:

//Sets the path to base URL         


        
10条回答
  •  星月不相逢
    2020-11-30 02:49

    You have to convert the response to JSON using Gson.toJson(object).

    For example:

    return Response.status(Status.OK).entity(new Gson().toJson(Student)).build();
    

提交回复
热议问题