title: How to set jackson serialization depth level when using ObjectMapper?
body: <p>Assuem that i have this below classes:</p>
  
  <pre><code>public class Employee {
      private Department department;
  
      // other fields, getters and setters omited for brevtity
  }
  
  public class Department {
      private Address address;
  
      // other fields, getters and setters omited for brevtity
  }
  
  public class Address {
      private Location location;
  
      // other fields, getters and setters omited for brevtity
  }
  
  public class Location {
      private String streetName;
  
      // other fields, getters and setters omited for brevtity
  }
  </code></pre>
  
  <p>now, i want to load <code>Employee</code> object and serialize it with <code>ObjectMapper</code>:</p>
  
  <pre><code>public void serializeEmployee() {
      Employee employee = entityManager.load(Employee.class, 1);
      ObjectMapper mapper = new ObjectMapper();
      System.out.println(mapper.writeValueAsString(student));
  }
  </code></pre>
  
  <p>when i run above code, i see json string like this:</p>
  
  <pre><code>{
      "department" : {
          "address" : {
              "location" : {
                  "streetName" : {}
              }
          }
      }
  }
  </code></pre>
  
  <p>but i want to set serialization depth to one level, i mean when the code run, i want to see result like this: </p>
  
  <pre><code>{
      "department" : {
      }
  }
  </code></pre>
  
  <p><strong>NOTE</strong></p>
  
  <p>I don't want to use jackson annotations, i want to set configuration when using <code>mapper</code> object. for exmaple with calling <code>mapper.setConfig</code> or <code>mapper.disable</code>.</p>