title: How to ignore "handler": {}, "hibernateLazyInitializer": {} in json jackson in Spring hibernate project?
body: <p>I am using fasterxml json with object mapper and below is my code:</p>
  
  <pre><code> ObjectMapper mapper = new ObjectMapper();
          mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
          mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  
          try {
              String jsonInString = mapper.writeValueAsString(myClassObjectHere);
              return new ResponseEntity&lt;String&gt;(jsonInString, HttpStatus.OK);
          } catch (JsonProcessingException e) {
              e.printStackTrace();
              return new ResponseEntity&lt;String&gt;(HttpStatus.INTERNAL_SERVER_ERROR);
          }
  </code></pre>
  
  <p>The way I have implemented and am using the code, i get desired output but json has 2 random strange values in certain json objects as follows:</p>
  
  <pre><code>"listing": {
            "listingId": 1,
            "name": "Business",
            "handler": {},
            "hibernateLazyInitializer": {}
          },
          "handler": {},
          "hibernateLazyInitializer": {}
        },
  </code></pre>
  
  <p>How to configure objectmappper to ignore <code>"handler": {}, "hibernateLazyInitializer": {}</code> values from outputted json ?</p>
  
  <p>I tried solutions below:</p>
  
  <pre><code>objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  </code></pre>
  
  <p>But its not working and the output is still the same as i posted above.
  Also, I know I can ignore these handler and hibernateLazyInitializer in json by annotating classes with <code>@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})</code> but is there <strong>any way to globally configure json jackson object mapper</strong> so that it never adds these values in my outputted json?</p>