当前位置: 代码迷 >> JavaScript >> jackson将json转入bean
  详细解决方案

jackson将json转入bean

热度:430   发布时间:2013-12-09 09:45:50.0
jackson将json转为bean
ObjectMapper mapper = new ObjectMapper();
		if (mapping != null) {
			try {
				UserPictureBo o = new UserPictureBo();
				if (mapping.getUserPictuerText() != null) {
					o = mapper.readValue(mapping.getUserPictuerText(), UserPictureBo.class);
				}
				BeanUtils.copyProperties(o, userPictureBo);
				BeanUtils.copyProperties(mapping, userPictureBo, new String[] { "pictureNormalUrl", "pictureBigUrl", "pictureSmallUrl" });
			} catch (JsonParseException e) {
				e.printStackTrace();
			} catch (JsonMappingException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return userPictureBo;
	}

?

  相关解决方案