JSON以GET或PUT方式传递给Java中的REST API,除了以下内容之外我还应该拥有哪些库?
-
bson-3.0.1.jar
-
jackson-annotations-2.3.2.jar
-
jackson-core-2.3.2.jar
-
jackson-databind-2.3.2.jar jackson-jaxrs-base-2.3.2.jar jackson-jaxrs-json-provider-2.3.2.jar
jackson-module-jaxb-annotations-2.3.2.jar jersey-entity-filtering-2.17.jar jersey-media-json-jackson-2.17.jar json-lib-2.2.2-jdk15.jar
我访问此REST服务时仍然收到以下错误:
EROOR:没有为类org.json.JSONObject找到序列化程序,也没有发现创建BeanSerializer的属性(为了避免异常,请禁用SerializationFeature.FAIL_ON_EMPTY_BEANS))
@GET
@Path("/getJSON2/{a}/{b}/{c}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getJSON2(@PathParam ("a") int a, @PathParam ("b") String b, @PathParam ("c") String c) throws JSONException
{
JSONObject js = new JSONObject();
Employee ee = new Employee();
ee.setId(a);
ee.setFname(b);
ee.setLName(c);
System.out.println("==========="+ee.toString());
js.put("employee", ee);
return js;
}