title: "JSON parse error: Cannot construct instance of (although at least one Creator exists): cannot deserialize from Object value - SpringBoot
body: <p>I am using SpringBoot with Mongo database and I am trying to save embedded documents into database.</p>
  <p>I have this model:</p>
  <p><strong>Profile.java</strong></p>
  <pre><code>@Data
  @Document
  public class Profile {
  
      public final City city;
      public final String imageId;
  
      public Profile(City city,
                     String imageId) {
          this.city = city;
          this.imageId = imageId;
      }
  
      @Override
      public String toString() {
          return &quot;Profile{&quot; +
                  &quot;, city=&quot; + city +
                  &quot;, imageId='&quot; + imageId + '\'' +
                  '}';
      }
  
      private static boolean atLeast(int numChars, String s) {
          if (s == null) {
              return false;
          }
          var str = s.strip();
          return str.length() &gt;= numChars;
      }
  
  
      public static ProfileBuilder builder() {
          return new ProfileBuilder();
      }
  
      public static final class ProfileBuilder {
          public City city;
          public String imageId;
  
          private ProfileBuilder() {
          }
  
  
          public ProfileBuilder withCity(City city) {
              this.city = city;
              return this;
          }
  
          public ProfileBuilder withImageId(String imageId) {
              this.imageId = imageId;
              return this;
          }
  
          public Profile build(){
              return new Profile(city, imageId);
          }
      }
  }
  </code></pre>
  <p><strong>City.java</strong></p>
  <pre><code>public class City {
  
      public final String name;
  
      public City(String name) {
          this.name = name;
      }
  
      @Override
      public String toString() {
          return &quot;City{&quot; +
                  &quot;, name='&quot; + name + '\'' +
                  '}';
      }
  }
  </code></pre>
  <p><strong>ProfileController.java</strong></p>
  <pre><code> @RequestMapping( method = RequestMethod.POST)
      public Profile addUser(@RequestBody Profile profile) {
          return profileService.addProfile(profile);
      }
  </code></pre>
  <p>and with postman I am sending this JSON</p>
  <pre><code>{
   &quot;city&quot;:{
     &quot;name&quot;:&quot;Atena&quot;
    },
     &quot;imageId&quot; : &quot;Doe&quot;,
    }
  }
  </code></pre>
  <p>But I am getting following error:</p>
  <pre><code>&quot;JSON parse error: Cannot construct instance of `domain.City` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator);&quot;
  </code></pre>