Exactly how to do this depends on the version of Jackson that you’re using. This changed around version 1.9, before that, you could do this by adding @JsonIgnore
to the getter.
Which you’ve tried:
Add @JsonIgnore on the getter method only
Do this, and also add a specific @JsonProperty
annotation for your JSON “password” field name to the setter method for the password on your object.
More recent versions of Jackson have added READ_ONLY
and WRITE_ONLY
annotation arguments for JsonProperty
. So you could also do something like:
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY) private String password;
Docs can be found here.
Related Posts:
- JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object
- No String-argument constructor/factory method to deserialize from String value (”)
- @Autowired – No qualifying bean of type found for dependency
- intellij incorrectly saying no beans of type found for autowired repository
- How to convert the following json string to java object?
- Jackson with JSON: Unrecognized field, not marked as ignorable
- No content to map due to end-of-input jackson parser
- How to parse JSON in Java
- When do you use Java’s @Override annotation and why?
- When is the @JsonProperty property used and what is it used for?
- Understanding Spring @Autowired usage
- com.atomikos.icatch.SysException: Error in init: Log already in use? tmlog in ./
- Spring @PropertySources value not overriding
- When is the @JsonProperty property used and what is it used for?
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- “NoClassDefFoundError: Could not initialize class” error
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘MyController’:
- Converting JSON data to Java object
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- How to send a Map in JSON
- A message body writer for Java class java.util.ArrayList and MIME media type application/json was not found
- Spring boot – Request method ‘POST’ not supported. Tried everything
- “NoClassDefFoundError: Could not initialize class” error
- “NoClassDefFoundError: Could not initialize class” error
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
- Difference between spring @Controller and @RestController annotation
- Unable to create requested service [org.hibernate .engine.jdbc.env.spi.JdbcEnvironment]-MySQL
- How to parse JSON in Java
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?
- How to parse JSON boolean value?
- com.sun.jdi.InvocationException occurred invoking method
- UnsatisfiedDependencyException: Error creating bean with name
- UnsatisfiedDependencyException: Error creating bean with name
- Spring Maven clean error – The requested profile “pom.xml” could not be activated because it does not exist
- Converting JSON to XML in Java
- Why SpringMVC Request method ‘GET’ not supported?
- How to read json file into java with simple JSON library
- Could not resolve placeholder in string value
- Simplest way to read JSON from a URL in Java
- Is spring default scope singleton or not?
- Meaning of @Resource annotation
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- How to create JSON Object using String?
- An established connection was aborted by the software in your host machine tomcat jackson
- MultipartException: Current request is not a multipart request
- How to Get JSON Array Within JSON Object?
- How to upload a file and JSON data in Postman?
- How to easily convert a BufferedReader to a String?
- Configure active profile in SpringBoot via Maven
- Downloading a file from spring controllers
- package org.json does not exist when importing org.json.JSONObject
- Parsing JSON string in Java
- java.lang.IllegalStateException: Failed to introspect Class
- Spring boot: Unable to start embedded Tomcat servlet container
- when spring boot startup,throw out the “method names must be tokens” exception
- model.addAttribute() parameters
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- “int cannot be dereferenced” in Java
- What is a Key-Value Pair?
- Create ArrayList from array
- MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser
- Can I catch multiple Java exceptions in the same catch clause?
- Can an abstract class have a constructor?
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- Recursive print Factorial
- Recompile with -Xlint:unchecked for detail error in java
- Convert array of strings into a string in Java
- How to get locator of current web element?
- javax.naming.NameNotFoundException
- How to print out all the elements of a List in Java?
- If Java is Strongly typed then why does this code compile?
- Error: cannot find symbol ArrayList
- Choosing the best concurrency list in Java
- Returning null in a method whose signature says return int?
- keytool error Keystore was tampered with, or password was incorrect
- Difference between a HashMap and a dictionary ADT
- Converting A String To Hexadecimal In Java
- javax.xml.bind.UnmarshalException: unexpected element (uri:””, local:”Group”)
- Enqueue, Dequeue and ViewQueue in Java
- JDK was not found on the computer for NetBeans 6.5
- In Java, how to assign the variable number=Integer.parseInt(args[0]) a value if no argument is passed?
- How are “mvn clean package” and “mvn clean install” different?
- Why are two empty ArrayLists with different generic types equal?
- java.lang.VerifyError: Inconsistent stackmap frames at branch target 421
- java: use StringBuilder to insert at the beginning
- Multiple delimiters in Scanner class of Java
- Eclipse Problems View not showing Errors anymore
- unexpected type error
- What does it mean: The serializable class does not declare a static final serialVersionUID field? [duplicate]
- “Cannot be resolved to a type” when attempting to use Scanner
- Converting a 2-3-4 tree into a red black tree
- Generic stack implementation
- Java generating non-repeating random numbers
- How to specify filepath in java?
- Issue installing Netbeans in Windows 10: Java SE Development Kit (JDK) was not found on this computer
- dequeue and enqueue methods in queue implementation
- How to specify the default error page in web.xml?
- Can’t seem to disable Java Automatic Update