String json="[{\"fid\":0,\"id\":1,\"name\":\"fjk的测试类目一级\"},{\"fid\":1,\"id\":2,\"name\":\"fjk的测试类目二级\"},{\"fid\":88,\"id\":98,\"name\":\"Women's Clothing\"},{\"fid\":2,\"id\":3,\"name\":\"fjk的测试类目三级\"},{\"fid\":98,\"id\":99,\"name\":\"Women's Dress\"},{\"fid\":98,\"id\":100,\"name\":\"Women's Outerwear\"},{\"fid\":98,\"id\":101,\"name\":\"Women's Bottom\"},{\"fid\":98,\"id\":102,\"name\":\"Women's Tops\"},{\"fid\":98,\"id\":103,\"name\":\"Women's Underwear & Socks\"},{\"fid\":0,\"id\":71,\"name\":\"本地生活类目\"},{\"fid\":98,\"id\":104,\"name\":\"Sleepwear & Accessories\"},{\"fid\":98,\"id\":105,\"name\":\"Loungewear\"},{\"fid\":71,\"id\":73,\"name\":\"本地生活类目222\"},{\"fid\":73,\"id\":74,\"name\":\"本地生活类目333\"},{\"fid\":20,\"id\":78,\"name\":\"LYJ测试三级类目\"},{\"fid\":0,\"id\":19,\"name\":\"李四一级分类\"},{\"fid\":19,\"id\":20,\"name\":\"李四的二级分类\"},{\"fid\":0,\"id\":88,\"name\":\"Fashion\"}]";
ObjectMapper objectMapper = new ObjectMapper();//创建object对象 objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);//忽略多余的字段 List<Cate> cates = objectMapper.readValue(json, new TypeReference<List<Cate>>() {});//转换 System.out.println(cates);
标签:fastjson,name,类目,98,json,fid,字符串,id,Women From: https://www.cnblogs.com/niun/p/17283061.html