对象与Json(key,value)互相转换
ObjectMapper om = new ObjectMapper();
//不要NULL 不要转了
om.setSerializationInclusion(Include.NON_NULL);
//将Json字符串转换为对象
buyerCart= om.readValue(cookie.getValue(), BuyerCart.class);
StringWriter w = new StringWriter();
//将对象转换为Json字符串;
om.writeValue(w,buyerCart);
Json字符串基本格式: {"属性1":值1,"属性2":值2}