日期:2014-05-16  浏览次数:20429 次

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;
	}

?