JsonMappingException No suitable constructor found

JsonMappingException No suitable constructor found

If you are using Jackson API to convert Java to JSON vice versa and get below exception:

Exception in thread “main” com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found

  • Solution: You will get this exception if default constructor is missing from java class while converting json object to java object. Please include default constructor in the class. As as example below Peoples class shows default constructor:

Peoples.java:

For more information please read Jackson documentation here

Leave a Reply

Your email address will not be published. Required fields are marked *