对象存在fastjson ----JSONObject中,然后取出来

对象存在fastjson ----JSONObject中,然后取出来
eg.FaceKeyLandmarks

   //取的过程
   JSONObject iFaceKeyAndPhysiognomy = iCoreService.faceppdetectDes(file, fcolor);
    Object landmarks =iFaceKeyAndPhysiognomy.get("faceKeyLandmarks");
    JSONObject json = (JSONObject)JSON.toJSON(landmarks);
    FaceKeyLandmarks faceKeyLandmarks=json.toJavaObject(FaceKeyLandmarks.class);

    //存的过程
    JSONObject result = new JSONObject();
    //构造对象
     FaceKeyLandmarks faceKeyLandmarks=new FaceKeyLandmarks();
    result.put("faceKeyLandmarks",faceKeyLandmarks);

你可能感兴趣的:(后端)