@jsonignore 在哪个jar
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了@jsonignore 在哪个jar相关的知识,希望对你有一定的参考价值。
参考技术A public class JackJsonTestpublic static void main(String[] args) throws IOException
User user = new User("abc", "id", 10);
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(user);
System.out.println(json);
User jsonUser = objectMapper.readValue(json, User.class);
System.out.println(jsonUser.getAge());
List<User> list = new ArrayList<User>();
list.add(new User("abc1", "id1", 101));
list.add(new User("abc2", "id2", 102));
list.add(new User("abc3", "id3", 103));
String listJson = objectMapper.writeValueAsString(list);
System.out.println(listJson);
List<User> beanList = objectMapper.readValue(listJson, new TypeReference<List<User>>()
);
for (User jsonUserList : beanList)
System.out.println(jsonUserList);
class User
private String name;
private String id;
private Integer age;
@JsonProperty(value = "aaa")
public String getName()
return name;
@JsonProperty(value = "aaa")
public void setName(String name)
this.name = name;
@JsonIgnore
public String getId()
return id;
public void setId(String id)
this.id = id;
public Integer getAge()
return age;
public void setAge(Integer age)
this.age = age;
public User()
public User(String name, String id, Integer age)
this.name = name;
this.id = id;
this.age = age;
@Override
public String toString()
return "User" +
"name='" + name + '\'' +
", id='" + id + '\'' +
", age=" + age +
'';
参考技术B import com.fasterxml.jackson.annotation.JsonIgnore;
查找在哪个jar中定义了类
Useful when you have to deal with ClassNotFoundException. The command looks for all jar in the current directory and any sub-directory, and checks if the jar contains the specified class. The command lists all matching jars.
find -name "*.jar" -exec grep "CLASSNAME" {} \; find -name "*.jar" -exec grep "org/junit/runners/Parameterized.class" {} \;
以上是关于@jsonignore 在哪个jar的主要内容,如果未能解决你的问题,请参考以下文章